X-Spam-Check-By: sourceware.org Date: Fri, 4 Aug 2006 11:05:36 -0400 (EDT) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: CB cc: cygwin AT cygwin DOT com Subject: Re: ssh breaks while loop Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Fri, 4 Aug 2006, CB wrote: > If file hostlist contains: > hosta > hostb > hostc > > then execute this shell script: > while read host > do > ssh $host ls -al .profile > done < hostlist > > the while loop executes one time and quits. > > But, > while read host > do > echo $host > done < hostlist > > executes 3 times. > > Am I missing something or is this a bug? WJFFM. There are many things that can be different in our environments. Are you sure you're reading the hosts separately? What's IFS set to? Try prepending something to $host in your second loop, e.g., "echo Host: $host" and see if you get them echoed one host at a time, or all three at once. You may also insert "echo" before the ssh in the first loop and see if you get 3 echoes. Also, is "set -e" in effect? If it is, the loop may be quitting if the first ssh returns false. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte." "But no -- you are no fool; you call yourself a fool, there's proof enough in that!" -- Rostand, "Cyrano de Bergerac" -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/