[ale] [OT] expect script question

Leam Hall leamhall at gmail.com
Thu Apr 5 20:00:17 EDT 2012


On 04/05/2012 07:41 PM, Robert Heaven wrote:
> I need to write an expect script to ssh to a host, do a cd to a dir,
> do an ls to list some file and then do chmod on certain files. I know
> that executing the "cd" and "ls" commands would use a simple "send"
> but, how do I capture the output of the "ls" and how do I loop
> through the list so that I can "send" the chmod command. I know how
> to do all these things in bash and perl, I'm just not familiar with
> tcl/tk.
>
> -Robert

Robert,

If you've installed Expect on a Linux box there are some demo programs
like "passmass". That might give you something to start with. Also, if 
you look at the files Expect installs there are some other things to read.

I don't recall enough expect to be more helpful, but the command you're 
looking for is "expect", oddly enough. You send something, expect 
something, and then send something else.

That help?

Leam


More information about the Ale mailing list