#!/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>"
send "get $1 .\r"
expect "sftp>"
send "exit\r"
send "\t"
interact
EOF
} || echo "Usage:$0 jar包名称"
expect非交互式下载sftp资源,解决$1变量不能识别的问题
最新推荐文章于 2023-01-30 20:46:58 发布