
shell
阿联酋土鳖
以微博之言,尽微薄之力!
展开
-
expect非交互式下载sftp资源,解决$1变量不能识别的问题
#!/bin/bash[ $# -eq 1 ] && {read -p "确定要下载包:$1? (y/n)" stat[ $stat != y ] && exit 1/usr/bin/expect << EOF set timeout 5 spawn sftp han@192.168.0.222:/data/han/ expect { "password:" { send han@123\r } } expect "sftp>原创 2020-07-07 11:14:31 · 448 阅读 · 0 评论 -
while循环判断服务端口是否正常启动
#!/bin/bashPORT=3306sum=0echo -n “Starting…”while [ $sum -le 20 ]donetstat -tunap | grep -w $PORT[ $? -eq 0 ] && echo “Start ok !!!” && breaksleep 2echo -n “.”[ $sum -eq 20 ] && echo -e “\nStart failed !!!”let sum++done原创 2020-07-04 12:29:51 · 588 阅读 · 0 评论