Expect Answer
Use send -- $argv
in your expect
script because $argv
holds the command line arguments.
As an example, I've this handy expect script that interacts with ssh
commands when admins stupidly disable public key authentication :
#!/usr/bin/expect -f
set timeout -1
set send_human {.6 .1 1.6 .1}
eval spawn $argv
match_max 100000
expect {
-re "LOGIN@(\[0-9A-Za-z_\\-\\.\]+)'s password: "
{ sleep 0.6 ; send -- "PASSWORD" ; sleep 0.1 }
interact
Use constructs like [lrange $argv 0 $argc]
if you need only part of the $argv
Perl Answer
Use system 'script.exp' $path
to call script.exp
from a perl
script, assuming use chmod
, etc., roughly like DeVadder said sans the quotes. Or use exec
if your perl
script wishes to terminate. Run man perlfunc
to read about perl commands.