代码
#!/bin/sh . /etc/init.d/functions if [ $# -ne 1 ];then echo "sh $0 arg0" exit 1 fi for ip in 172.23.216.86 172.23.216.87 #for ip in 172.23.216.87 do scp -r -p $1 oldboy888@$ip:~ >/dev/null 2>&1 #打印输出到空,错误输出到空 if [ $? -eq 0 ];then action "scp is ok" /bin/true else action "scp is no" /bin/false fi done
效果