<p>process_line () {<br>
#do chmod test here<br>
# write files to be changed to filelist<br>
}</p>
<p>output=$( ssh user@mach "cd path; ls -1l)<br>
while read myout<br>
do<br>
process_line $myout<br>
done < $(cat ${output})<br>
for myfile in ${filelist}; do<br>
ssh user@mach "cd dir; chmod 420 $myfile"<br>
done</p>
<div class="gmail_quote">On Apr 5, 2012 7:42 PM, "Robert Heaven" <<a href="mailto:roberth1954@aim.com">roberth1954@aim.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>
<br>
-Robert<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</blockquote></div>