shell 批量远程主机执行命令


[yunwei@Y24-209 ~]$cat ls.sh #!/bin/bash ip55=`cat ip1` for i in $ip55;do ping -c 1 $i if [ $? -eq 0 ];then ssh -t $i "ls" if [ $? -eq 0 ];then echo -e "$i" >> ok.ip else echo -e "$i" >> fail.ip fi else echo -e "$i" >> fail.ip fi done

  

猜你喜欢

转载自www.cnblogs.com/lixinliang/p/10695439.html