Last active
August 29, 2015 14:08
-
-
Save amashigeseiji/8840effa4e523f089739 to your computer and use it in GitHub Desktop.
send command to remote server over ssh
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 10 | |
spawn ssh [lindex $argv 0] | |
expect { | |
"Last login" { | |
send [lrange $argv 1 $argc]\n | |
send exit\n | |
} | |
timeout { | |
send_user "connection is timeout.\n" | |
exit | |
} | |
} | |
interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment