For example, the following prints out the name of the script and the first three arguments: Expect uses Tcl (Tool Command Language).
Tcl provides control flow (e.g., if, for, break), expression evaluation and several other features such as recursion, procedure definition, etc.
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 #! The file $exp_library/is sourced automatically if present, unless the -N flag is used.
(When using Expectk, this option is specified as -NORC.) Immediately after this, the file ~/.is sourced automatically, unless the -n flag is used.
It is occasionally desirable to read files one line at a time. In order to force arbitrary files to be handled this way, use the -b flag.If the environment variable DOTDIR is defined, it is treated as a directory and .is read from there.(When using Expectk, this option is specified as -norc.) This sourcing occurs only after executing any -c flags.Expect can actually talk to several programs at the same time.For example, here are some things Expect can do: There are a variety of reasons why the shell cannot perform these tasks. In general, Expect is useful for running any program which requires interaction between the program and the user.
(When using Expectk, this option is specified as -buffer.) Note that stdio-buffering may still take place however this shouldn't cause problems when reading from a fifo or stdin.