My experience with
expect is limited and ancient, but yes, you can do this. The easiest way, IMO, is to use
expect scripts. The man page discusses how the first line of an
expect script could look:
Code:
-- may be used to delimit the end of the options. This is
useful if you want to pass an option-like argument to your
script without it being interpreted by Expect. This can
usefully be placed in the #! line to prevent any flag-like
interpretation by Expect. For example, the following will
leave the original arguments (including the script name)
in the variable argv.
#!/usr/local/bin/expect --
Note that the usual getopt(3) and execve(2) conventions
must be observed when adding arguments to the #! line.
Of course, you'd use
#!/usr/bin/expect.
Hope this helps.