Skip to content

Instantly share code, notes, and snippets.

@JonTheNiceGuy
Last active October 19, 2016 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonTheNiceGuy/1a677f9d0f216dc21c28c4131a347f9b to your computer and use it in GitHub Desktop.
Save JonTheNiceGuy/1a677f9d0f216dc21c28c4131a347f9b to your computer and use it in GitHub Desktop.
#!/usr/bin/expect
set arg1 [lindex $argv 0]
set arg2 [lindex $argv 1]
set arg3 [lindex $argv 2]
set timeout 1000
spawn sftp "$arg2"
expect {
yes {
send "yes\r"
exp_continue
}
ass {
send "$arg3\r"
exp_continue
}
sftp {
send "put $arg1\r"
expect {
100% {
send "quit\r"
exp_continue
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment