get sftp file in active with expect
#sftp服务器免密下载文件
expect <<EOF
spawn sftp test@192.168.2.1
expect "password"
send "12345678\n"
expect "sftp>"
send "cd /ftp/dir/\n"
expect "sftp>"
send "get test.tgz\n"
expect "sftp>"
send "exit"
EOF
#sftp服务器免密下载文件
expect <<EOF
spawn sftp test@192.168.2.1
expect "password"
send "12345678\n"
expect "sftp>"
send "cd /ftp/dir/\n"
expect "sftp>"
send "get test.tgz\n"
expect "sftp>"
send "exit"
EOF