-
-
Save briansorahan/6812353 to your computer and use it in GitHub Desktop.
Use expect to automate scp with password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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