[NTLUG:Discuss] Scripting help

Carl Haddick sysmail at glade.net
Tue Oct 14 08:17:00 CDT 2014


> -----Original Message-----
> From: Discuss [mailto:discuss-bounces at ntlug.org] On Behalf Of Christopher
> Cox
> Sent: Monday, October 13, 2014 9:00 PM
> To: discuss at ntlug.org
> Subject: Re: [NTLUG:Discuss] Scripting help
> 
> Just for clarification, it's needed on the client side.... not on the
servers you're
> telnetting to.
> 

Here's an expect trick I've been using lately. Ssh'ing to a large number of
machines of various types and shell prompts caused some difficulty, so I
standardized the prompt like this:

spawn ssh hostname -t "export PS1='---safeprompt---' ; exec ksh"

That launches ksh and the first shell prompt the expect script sees is
"---safeprompt---".

Ksh doesn't process it's profile in this case, so the first thing to send is
export PATH=whatever:you:want.

I'm hardly an authority and would appreciate learning better ways to skin
the cat.

Python expect is much more fun, for me, anyway, than good old NIST
tcl/expect. Make yourself a class to wrap around python's expect features
and you can make short work of automating an awful lot.

Regards,

Carl
 




More information about the Discuss mailing list