I have the following autoexpect script:
set timeout -1
spawn telnet 86.216.72.205
match_max 100000
expect -exact "Trying...\r
Connected to 86.216.72.205.\r
Escape character is '^\]'.\r
Local flow control off\r
\r
Please select a destination:\r
1. Power Plant administration, need Galaxy controller password.\r
2. Network Administration, requires network administration password.\r
"
send -- "1\r"
expect -exact "1\r
\r
TECLEE CLAVE:\r
ENTER PASSWORD: "
send -- "super-user\r"
expect -exact "\r
\r
** "
send -- "ampeers\r"
expect -exact ".\r
** "
send -- "bye\r"
expect eof
I want to be able to pass it an ip address using an argument instead of having it hard coded in. Expect is something I am totally ignorant about. I have a file that will determine which IP address I will pass it. Please help!!!
Here is what you are looking for:
http://oldlook-search.experts-exchange.com/questions/20476614/automate-additions-of-users-and-passwords-with-shell-script.html
---
#!/usr/local/bin/expect -f <=== path may vary
# useage: scriptname IP
set ipaddress [lindex $argv 0]
expect "IP Address: "
send "$ipaddress\n"
expect eof
----
Wesly