Re: expect, spawn with preset variables
From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: 11/19/03
- Next message: Bruce Hartweg: "Mail monitoring/proxy tool"
- Previous message: Cameron Laird: "Re: expect, spawn with preset variables"
- In reply to: Cameron Laird: "Re: expect, spawn with preset variables"
- Next in thread: Glenn Jackman: "Re: expect, spawn with preset variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Bruce Hartweg: "Mail monitoring/proxy tool"
- Previous message: Cameron Laird: "Re: expect, spawn with preset variables"
- In reply to: Cameron Laird: "Re: expect, spawn with preset variables"
- Next in thread: Glenn Jackman: "Re: expect, spawn with preset variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|