Skip to content

Instantly share code, notes, and snippets.

@briansorahan
Created October 3, 2013 16:07
Show Gist options
  • Save briansorahan/6812353 to your computer and use it in GitHub Desktop.
Save briansorahan/6812353 to your computer and use it in GitHub Desktop.
Use expect to automate scp with password
#!/usr/bin/env expect
set timeout 120
set login [lindex $argv 0]
set password [lindex $argv 1]
set f [lindex $argv 2]
set r [lindex $argv 3]
spawn scp $f $login:$r
expect {
"assword:" {
send "$password\r"
}
}
expect {
"$ "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment