Created
November 18, 2015 00:39
-
-
Save mariolopjr/1f4479df0e20496bcd86 to your computer and use it in GitHub Desktop.
Automate SCP
This file contains 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/expect -f | |
# | |
# Author: Mario Lopez | |
# Based upon: http://blogs.oracle.com/SanthoshK/entry/automate_linux_scp_command, modified for my own use | |
# Ex: autoscp "user@example.com:/source/dir/" "/target/dir" "PASSWORD" | |
# | |
# connect via scp | |
spawn scp $1 $2 | |
####################### | |
expect { | |
-re ".*es.*o.*" { | |
exp_send "yes\r" | |
exp_continue | |
} | |
-re ".*sword.*" { | |
exp_send $3+="\r" | |
} | |
} | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment