I have simple expect script that I want to pass a variable to via a web form. Any suggestions on how this can be done? One method I've seen is to dynamically generate the expect by using a simple echo from bash and then executing the expect script. Is there a way to pass the variable to expect with doing such dynamic generation?
*********************************************
#!/usr/local/bin/expect -f
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn ssh -l userid hostname
match_max 100000
expect -exact "userid's password: "
send -- "password\r"
expect -exact "\r\r blah blah blah"
send -- "./tshoot VARIABLE> test.html\r"
exec sleep 3
send -- "exit\r"
expect eof
*********************************************
#!/usr/local/bin/expect -f
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn ssh -l userid hostname
match_max 100000
expect -exact "userid's password: "
send -- "password\r"
expect -exact "\r\r blah blah blah"
send -- "./tshoot VARIABLE> test.html\r"
exec sleep 3
send -- "exit\r"
expect eof