Skip to content

Instantly share code, notes, and snippets.

@young001
Created May 4, 2013 14:01
Show Gist options
  • Save young001/5517595 to your computer and use it in GitHub Desktop.
Save young001/5517595 to your computer and use it in GitHub Desktop.
expect
#!/usr/bin/expect -f
# ./ssh.exp password 192.168.1.11 id
set name [lrange $argv 2 2]
set server [lrange $argv 1 1]
set pass [lrange $argv 0 0]
spawn ssh $name@$server
match_max 100000
expect "*?assword:*"
send -- "$pass\r"
send -- "\r"
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment