I have an autoexpect script. I modified it and it works great, however when it finish to run it hangs and I need to do ctrl+C in order to get my terminal
[..]
887VA#logout
Connection to 10.255.255.1 closed by remote host.
Connection to 10.255.255.1 closed.
root@blackbox:/etc/myscripts#
^Croot@blackbox:/etc/myscripts# ^C
root@blackbox:/etc/myscripts#
In the blank space above I pressed enter many times
Code
#!/usr/bin/expect -f
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn $env(SHELL)
match_max 100000
send -- "ssh f.olivieri@10.255.255.1\r"
expect -exact "Password: "
send -- "passwordhere!!!\r"
expect -exact "887VA#"
send -- "show interface vlan 2\r"
expect -exact "Vlan2 is up, line protocol is up \r"
send -- "logout\r"
expect eof