save the result of ls command in the remote sftp server on local machine
问题 I have seen This question but I am not satisfied with answer. I connect to remote sftp server and I will do ls there I want to have the result of ls on my local machine. I don't want any thing extra to be saved, only the result of ls command. Can I save the result to a variable accessible on the local machine? #!/usr/bin/expect spawn sftp myuser@myftp.mydomain.com expect "password:" send "mypassword\n"; expect "sftp>" send "ls\n" //save here interact 回答1: Here's how I would do it, with a more