cost - 2016-12-31 11:28:00
My Bash script:
#!/usr/bin/expect
spawn ssh -L10000:localhost:80 root@192.168.1.10
expect "password:" {send "password\r"}
interact
I need to match if the tunnel SSH is up, something like this:
spawn ssh -L10000:localhost:80 root@192.168.1.10
ssh: connect to host 192.168.1.10 port 22: No route to host -> if exist "No route to host" echo -> "the host is not reachable"
elseif -> output is equal to "Last login: Sun Dec 25 14:50:49 2016 from 192.168.1.90
[root@test ~]# " echo -> "the tunnel ssh is up"