Hi guys, sorry to submit what seems to be a really basic issue,
but I didn't find any relevant info searching the web.
Here is my problem.
I'm running expect scripts on a SunOS 5.8 to connect
to routers/switchs and perform repetitive tasks.
Everything works properly.
Now I would like to use expect scripting to run shell
commands on the sun station (snmpwalk...), my issue
lies in the fact I don't see the commands in "send"
after logging, and the outputs of this commands neither.
Here is a script I tried for just connecting
the server, login, and performing a "ls" :
---------------
#!/usr/local/bin/expect -f
set env(TERM) vt100
spawn telnet IPaddy
expect -- "login:" {send "blah\r"}
sleep 1
expect -- "Password:" {send "blah\r"}
send_user "\n step1 \n"
send "ls\r"
send_user "step2 \n"
send "blahblahblah-whatever\r"
---------------
Here is the result when executing the script :
[puter]/home/blah #test3.exp
spawn telnet IPaddy
Trying x.x.x.x...
Connected to x.x.x.x
Escape character is '^]'.
SunOS 5.8
login: blah
Password:
step1
step2
[puter]/home/blah #
---> no ls is "printed" on screen, no ls output either...
I tried to spawn a shell instead of a telnet, with no better
results.
Any idea what's wrong ?
Cheers,
Nicolas.