How to (shell) script sftp

Just a small reminder (for myself):

/usr/bin/expect <<EOF
spawn /usr/bin/sftp host.domain
expect "\\n|\\r"
expect "..."
expect "\\n|\\r"
expect "password:"
send PASSWORDXXX\\r
expect "sftp> "
send "ls \\r"
expect "sftp> "
send "bye \\r"
EOF

And read:

man expect

Technorati Tags: , ,

Technorati Tags: , ,

Reply