Re: Expect scripting

Knilges wrote:

I couldn't think of how to capture text from a telnet session so again
I reverted to what I am familiar with which is script and used exec
although I though spawn would do the same thing. What is the
difference there?
> My thoughts were that exec is using the shell and
spawn is basically doing the same. Is that misguided?

Shoot your guidedog! ;-)

NEITHER uses the shell.

exec has a shell-similar piping and redirection syntax.
but it ends there.

spawn hangs your process onto the tty side of a pty.
i.e. your spawned program will feel right at home just
like in the interactive environment it was written for.


Relevant Pages

  • Re: detect shell script language
    ... In the 'old' days, when a user typed in a command, the interactive shell would immediately pass it off to 'exec' to execute. ... So, on return from exec with an error status, the shell would fork a copy of itself to try and run the script. ... As a result of the above, it was hard to tell whether the script was a Bourne shell or C shell, so the convention was introduced of using the Bourne shell no op command, as the first line in a Bourne shell script. ...
  • Re: Subshells with bash piping into tee
    ... >I have a bash v2 script where I'm doing something like this: ... SHELL=/tmp/file.$$; export SHELL ... >Logging is optional and it's acceptable to turn logging off ... 'exec' is also a shell builtin and has a useful property that if given ...
  • Re: Script Header
    ... > On a shell script, ... > You can TRY to execute a garbage file. ... > filename: Exec format error. ... - The shell will check whether this file has the executable flag set, ...
  • Re: Start only one program at login
    ... |> The duration of the .xsession script is the duration of your login. ... |> manager - quitting the window manager logs you out. ... You don't need two exec lines. ... Normally the called program is a child of the shell. ...
  • Re: Running a perl script thru a perl script
    ... > of sorts to pass to this script. ... array of hashes instead, if you want to keep the corresponding from and to ... > minimum and I know that the exec() function opens up a shell (which takes ... It only uses a shell in certain circumstances: ...