Re: [expect] passing compound arguments to spawn
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: [expect] passing compound arguments to spawn

From: Andrew Falanga <not_real@hp.com>
Date: Tue Dec 13 2005 - 20:37:25 CET

Bruce Hartweg wrote:
>
>
> Andrew Falanga wrote:
>> Uwe Klein wrote:
>>
>>> Andrew Falanga wrote:
>>>
>>>> Hi,
>>>>
>>>> This one is a simple one but I'm an expect neophyte. I want to use
>>>> expect to make a remote system execute some commands using ssh. So,
>>>> my command looks like this:
>>>>
>>>> eval spawn ssh user@host "cmd1; cmd2; cmd3"
>>>
>>> on what platform ?
>>>
>>>
>>> this works for me without a hitch:
>>>
>>> spawn ssh uwe@otherhost "dir ; ps ; uptime"
>>> expect
>>> <res = "Password: ">
>>>
>>> exp_send "somepassword\r"
>>> expect
>>> <res = lots of output including filelistings,
>>> processlistings and uptime statistics>
>>>
>>>
>>>
>>
>> Sorry for taking this long to respond. I had other things suddenly come
>> up that made this little project "meaningless" for the time being. Now
>> I'm looking into it again.
>>
>> In your example, what does the <res = "Password: "> exactly mean? I'm
>> very familiar with TCL but I've not see that before. Are you refering
>> to something like "psuedo" code or using some sort of short hand to
>> explain something or does the expect command use syntax of
>>
>> <res = "Password: ">
>>
>> Please explain what is meant by this code.
>>
>> Thanks
>>
>
> I think it was inline editorializing of what is seen on the console.
>
> Did you see Cameron's reply? Namely that the root of your issue
> is the unneccessary use of "eval" ?
>
>
> Bruce
>
I did. Please explain why eval is unnecessary in this case?

-- 
---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled.  I do not wish my account at HP to
become a spam haven.
Received on Fri Dec 23 19:00:24 2005