这是我的脚本
#!/bin/ksh
RemoteFile=`grep "${File}" ${TempLog}` --> the value of the variable is Site Information_2013-07-04-00-01-26.CSV
/usr/bin/expect << EOF
spawn sftp user@server
expect "password:"
send "123fakepassword\n"
expect "sftp>"
send "cd /home/user/pickup_dir\n"
expect "sftp>"
send "lcd /home/user/Scripts/mart/wmt/RAMDISK0\n"
expect "sftp>"
send "get $RemoteFile\n" ---> I'm trying to pass it here so I can download the file.
expect "sftp>"
send "exit\r"
EOF
但没有运气!,我怎样才能传递一个带双引号的文件名,所以它会执行为 (get "Site Information_2013-07-04-00-01-26.CSV\n") 我把它放在变量中导致文件名更改日期。还是我做错了?我知道硬编码密码不好,但我们不能使用 ssh-key 来拥有无密码的 sftp。谢谢!