unixrookie
MIS
Hello all,
Can anyone tell me how to pass multiple arguments in an expect script. I can't seem to get more than one to work. Below is my test script this script will spawn a telnet session connect to a router then kick back the output for a show interface command. right now the only variable that you see is the interfae name. i'd like to pass the ip address first then the interface name as variable 1 and variable 2.
Thanks in advance.
Mark
#!/usr/bin/expect --
log_user 0
set timeout 60
spawn telnet 192.168.1.1
expect "Username:"
send "routeradmin\r"
expect "Password:"
send "password\r"
expect "core-router#"
log_user 1
send "show int $argv \r"
expect "core-router#"
log_user 0
send "exit\r"
send_user "\n"
Can anyone tell me how to pass multiple arguments in an expect script. I can't seem to get more than one to work. Below is my test script this script will spawn a telnet session connect to a router then kick back the output for a show interface command. right now the only variable that you see is the interfae name. i'd like to pass the ip address first then the interface name as variable 1 and variable 2.
Thanks in advance.
Mark
#!/usr/bin/expect --
log_user 0
set timeout 60
spawn telnet 192.168.1.1
expect "Username:"
send "routeradmin\r"
expect "Password:"
send "password\r"
expect "core-router#"
log_user 1
send "show int $argv \r"
expect "core-router#"
log_user 0
send "exit\r"
send_user "\n"