Re: expect, spawn with preset variables

From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: 11/19/03


Date: Wed, 19 Nov 2003 03:23:52 GMT


Cameron Laird wrote:

> In article <eccee6457af783f6b1c82e7d8c3e7418@news.teranews.com>,
> * Tong * <sun_tong@users.sourceforge.net> wrote:
>
>>Hi,
>>
>>Sometimes we need to set a certain variable before launching a command. In
>>normal shell, we can do
>>
>>VAR=value command parameters
>>
>>I tried to do the same thing using spawn in expect, but failed.
>>
>>What should I do if I have to set a certain variable before launching a
>>command?
>
> .
> .
> .
> Example:
> set host 198.132.14.9
> spawn telnet $host
>
> You *really* need to get the Expect book.

while the example does set a variable (and the recommendation
for getting the book is heartily seconded) the OP may be referring
to setting a variable that the *spawned* program needs, rather than
using an internal variable to the script. In which case the env var
may be what the doctor ordered

set ::env(VAR) value
spawn command parameters

Bruce



Relevant Pages

  • Re: EnableShellOpen() for windows mobile
    ... on the command line (assuming that's where you're ... launching it from, of course). ... Paul T. ... Remote Registry Editor, as what you have there doesn't tell me what I ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Puzzling LIB$SPAWN problem with DEC BASIC
    ... :I'm trying to do something very simple - spawn a process from a BASIC ... You are using asynchronous coding techniques now, ... MAIL command. ... If the program exits before the mail is sent, the subprocess can get ...
    (comp.os.vms)
  • exec or spawning a tcl program using winXP START
    ... fine if I launch the program from a command line e.g. ... However when I try and put this into a spawn command I run into ... while executing ... Any help on changing the Base Priority of a spawned process from ...
    (comp.lang.tcl)
  • Re: output error messages
    ... I'm sure there is an error message being displayed by the 'mv' ... command, but I don't know how to access the message. ... script via a parameter value. ... Currently I'm using the 'spawn' syntax to launch commands, ...
    (comp.lang.tcl)
  • Re: Word crashes when opening file
    ... command isn't being handled it doesn't mean there is a "bug" in the program ... launching Word itself or creating new documents once Word launches, ... duplicate fonts & other font problems aren't likely to be the issue. ... toolbar to open something or press command and "o" the program freezes. ...
    (microsoft.public.mac.office.word)