Computing.Net > Forums > Solaris > Issue expect scripting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Issue expect scripting

Reply to Message Icon

Name: Nicolas F
Date: June 24, 2004 at 05:48:05 Pacific
OS: SunOS 5.8
CPU/Ram: ?
Comment:

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.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: Issue expect scripting

Need some help on Unix script www.computing.net/answers/solaris/need-some-help-on-unix-script/4408.html

Expect Scripting on Solaris www.computing.net/answers/solaris/expect-scripting-on-solaris/3723.html

redirect to web page in korn shell www.computing.net/answers/solaris/redirect-to-web-page-in-korn-shell/3691.html