This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need help running expect script under CYGWIN...

Hi, much thanks in advance for any and all help anyone can provide.  

I'm by no means a scripting/*NIX/Expect guru - but a while back was able to
stumble  through setting up Windows/CYGWIN/expect enough to put together a
really functional system for basic network management of Cisco routers and
switches.  Everything ran fine on my old laptop which died recently.  I've
just downloaded the latest CYGWIN to my new laptop (I'm assuming a newer
version since last July) and none of my scripts will work any longer.  They
are very basic - essentially they just spawn telnet to a host and do what's
in the script.  It appears that with the current version of CYGWIN (or the
expect that runs in it) the spawn sessions are dying early.  I've scoured
the internet for help, but while there are several people in my same boat -
I'm not finding any solutions.  Attached below is my error message, my
expect script, and my (simple) shell script that pipes in a list of
names/IPs as arguments to expect.

I really relied on this to manage a large number of switches in the past and
am really hurting not having this - thanks for any input at all.



Spawn telnet pn-abrams-switch
Send: invalid spawn id (4)


set timeout 20
set ROUTER $argv
spawn telnet $ROUTER 
expect "Username: "
send "$USER_NAME\r"
expect "Password: "
send "$USER_PASS\r"
expect "#$"
send "term length 0\r"
expect "#$"
log_file ./output/$ROUTER-show_run.txt
send "sh run | include hostname\r"
expect "#$"
send "\r"
expect "#$"
send "\r"
expect "#$"
send "sh run"
expect "#$"
send "\r"
expect "#$"
send "exit\r"


for ROUTER in `cat names.txt`; do ./expect-BABW-show_run.txt $ROUTER; done

View this message in context:
Sent from the Cygwin Users forum at

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]