Computing.Net > Forums > Solaris > Issue expect scripting

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Issue expect scripting

Reply to Message Icon

Original Message
Name: Nicolas F
Date: June 24, 2004 at 05:48:05 Pacific
Subject: Issue expect scripting
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.


Report Offensive Message For Removal








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








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 7 Days.
Discuss in The Lounge
Poll History




Data Recovery Software