Simple EXPECT script to execute remote command and displat output
- by s.mihai
I am trying to connect to a network router and execute show status on it.
Currently i am using:
spawn ssh -o StrictHostKeyChecking=no [email protected]
expect " * ? password:*\r"
send -- "secretPassword\r"
sleep 5
send -- "show status\r"
sleep 10
send -- "exit\r"
It dosen't work, i get stuck at [email protected]'s password:i've tried entering the password but it does not work, i get:
server1:~# secretPassword
-bash: server1: command not found
server1:~#What am i doing so wrong here ... ?