눈바래다

#!/bin/sh

 

while read server # 읽어올 행이 더이상 없는 경우는 리턴값이 1 되므로 지점에서 while 종료함.

do

 ssh -n $server "$@" # ssh -n옵션으로 ssh 커맨드에 표준입력을 실행하지 않도록 지정함

done

 

[root@linuxtest kim]# ./t5.sh hostname < server.txt

[root@linuxtest kim]# cat server.txt

root@10.20.12.58

root@10.20.12.148

root@10.20.12.37

root@10.20.12.83

root@10.20.12.51

root@10.20.12.52

root@10.20.12.144