expect script handles the port

This commit is contained in:
John Bender 2010-01-30 00:14:39 -08:00
parent f4cc3d430b
commit b11bad4788
1 changed files with 8 additions and 1 deletions

View File

@ -3,8 +3,15 @@
set uname [lrange $argv 0 0]
set password [lrange $argv 1 1]
set host [lrange $argv 2 2]
set port [lrange $argv 3 3]
spawn ssh $uname@$host
if { $port != "" } {
set port_option "-p $port"
} else {
set port_option ""
}
spawn ssh $port_option $uname@$host
expect "*password: " {
sleep 1