Now Perl can pass things on the command line. I don't know enough TCL to know if there is a cleaner way to do this processing (I would *hope* that there is). But it works.set i 0 while {$i < $argc} { if ![string compare "-m" [lindex $argv $i]] { incr i if $i==$argc { send_user "-m specified without machine, FAILING" exit -3 } set machine [lindex $argv $i] } elseif ![string compare "-n" [lindex $argv $i]] { incr i if $i==$argc { send_user "-n specified without name, FAILING" exit -3 } set name [lindex $argv $i] } elseif ![string compare "-p" [lindex $argv $i]] { incr i if $i==$argc { send_user "-p specified without password, FAILING" exit -3 } set password [lindex $argv $i] } elseif ![string compare "-c" [lindex $argv $i]] { incr i if $i==$argc { send_user "-c specified without argument, FAILING" exit -3 } set cmd [lindex $argv $i] } incr i }
Incidentally I would suggest that before hand-rolling a lot of Expect scripts that you look to CPAN for modules to drive the same things. For instance try Net::Telnet or failing that, Expect. Then you don't need to mix languages and error handling will probably be a bit easier as a result...
In reply to Re (tilly) 1: Cannot pass arg from perl to expect
by tilly
in thread Cannot pass arg from perl to expect
by scott09
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |