Computing.Net > Forums > Linux > Spawn, expect and send

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.

Spawn, expect and send

Reply to Message Icon

Name: iancaem02
Date: April 29, 2008 at 19:53:08 Pacific
OS: linux
CPU/Ram: 256
Product: dell
Comment:

Hi, need help..
i have file to doing telnet to some address but it doesn't work..where is the mistake :

#/sbin/sh
#!/usr/bin/expect

#Var_Glob
set myServ 192.x.x.x
set myPass1 xxxx

spawn telnet $myServ
expect "password:"

# Send the password, and then wait for a shell prompt
send "$myPass1\r"

send command

send "quit\r"
expect eof

#end file

but after I excute I got mistake message:

spawn: command not found
couldn't read file "password:": no such file or directory
send: command not found
send: command not found
couldn't read file "eof": no such file or directory

so what should I do..
Need anyone advice..

Thanx so lot

BEST REGARDS
ADRIAN



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: April 30, 2008 at 07:42:03 Pacific
Reply:

First, since this is an expect script, I'd remove this:

#/sbin/sh

Whatever your shell invocation is - expect in this case - always make sure that it's on line 1 beginning in column 1:

#!/usr/bin/expect

Second, you are getting this error because expect doesn't recognize what "command" is. I certainly don't see where command is defined in the script.


0
Reply to Message Icon

Related Posts

See More


VMware Workstation 6 over... Linux installation proble...



Post Locked

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


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Spawn, expect and send

Expect and Index www.computing.net/answers/linux/expect-and-index/30024.html

single passwd command www.computing.net/answers/linux/single-passwd-command/12168.html

expect script www.computing.net/answers/linux/expect-script/19752.html