You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
392 B

set cmd [lindex $argv 0]
set pwd [lindex $argv 1]
#exp_internal 1
# 1 min timeout
#set timeout 60
set timeout -1
eval spawn $cmd
expect {
-nocase "(yes/no)?" { send "yes\r"; exp_continue }
-nocase "Password:" { send "$pwd\r" }
# Handling ssh keys have already been set up.
eof { exit }
#timeout { exit 1 }
}
# Wait for eof.
expect
exit 0