Created
January 8, 2013 12:09
-
-
Save shaon/6dc04ab0acba9a788a3f to your computer and use it in GitHub Desktop.
simple Expect script to ssh to another machine.
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/expect | |
set timeout 1 | |
set cmd {uname -a} | |
spawn ssh root@$argv | |
expect_after eof { exit 0 } | |
## interact with SSH | |
expect "yes/no" { send "yes\r" } | |
expect "password:" { send "reb00t\r" } | |
expect "# " | |
send "$cmd\r" | |
expect "# " | |
send "ls\r" | |
expect "# " | |
##send "exit\r" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment