[ale] [OT] expect script question

Jim Kinney jim.kinney at gmail.com
Thu Apr 5 23:21:45 EDT 2012


process_line () {
#do chmod test here
# write files to be changed to filelist
}

output=$( ssh user at mach "cd path; ls -1l)
while read myout
do
   process_line $myout
done < $(cat ${output})
for myfile in ${filelist}; do
ssh user at mach "cd dir; chmod 420 $myfile"
done
On Apr 5, 2012 7:42 PM, "Robert Heaven" <roberth1954 at aim.com> 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
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20120405/9dab4859/attachment.html 


More information about the Ale mailing list