Hi All,
This is my first post here although I have been browsing these forums for a while and found a lot of useful information
I am having trouble getting expect to work on my 8.04 server. I have tried to create script to telnet into my router but expect just does not seem to work. Here is my script:
#!/usr/bin/expect
set timeout 20 #If it all goes pear shaped the script will timeout after 20 seconds.
spawn telnet 192.168.1.1 #This spawns the telnet program
match_max 100000
expect -exact "Trying 192.168.1.1...\r
Connected to 192.168.1.1.\r
Escape character is '^]'.\r
VOYAGER2110 \r
Software Version: 3.03c\r
Login name: "
send -- "admin\r" #The script sends the user variable
expect -exact "admin\r
Password: "
send -- "**********\r" #The script sends the password variable
interact
When I try to run the script I get the following errors:
./expect_telnet.sh: line 6: spawn: command not found
./expect_telnet.sh: line 7: match_max: command not found
expect: invalid option -- e
usage: expect [-div] [-c cmds] [[-f] cmdfile] [args]
./expect_telnet.sh: line 15: send: command not found
expect: invalid option -- e
usage: expect [-div] [-c cmds] [[-f] cmdfile] [args]
./expect_telnet.sh: line 19: send: command not found
./expect_telnet.sh: line 20: interact: command not found
So it looks like expect is not working at all.
Any ideas on what the problem might be would be greatly appreciated.
Cheers
R_R



Adv Reply

Bookmarks