Hi. I like expect. Have you already checked out some online tutorials?<br><br>The example below shows a couple of features I like for the kind of thing you're doing. You'll need spawn, too.<br><br>ecashin@Ed-Cashins-MacBook-Pro tmps$ ~/tmp/exp-eg<br>
username: hallandoats<br>hallandoats<br>ecashin@Ed-Cashins-MacBook-Pro tmps$ cat ~/tmp/exp-eg<br>#! /usr/bin/expect<br><br>send "username: "<br>expect -re "(.*)\n"<br>set user $expect_out(1,string)<br>
send "$user\n"<br>ecashin@Ed-Cashins-MacBook-Pro tmps$ <br><br><div class="gmail_quote">On Thu, Apr 5, 2012 at 7:41 PM, Robert Heaven <span dir="ltr"><<a href="mailto:roberth1954@aim.com">roberth1954@aim.com</a>></span> wrote:<br>
<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><br><br clear="all"><br>-- <br> Ed Cashin <<a href="mailto:ecashin@noserose.net">ecashin@noserose.net</a>><br> <a href="http://noserose.net/e/">http://noserose.net/e/</a><br> <a href="http://www.coraid.com/">http://www.coraid.com/</a><br>