X-Spam-Check-By: sourceware.org Date: Mon, 14 Aug 2006 22:55:23 +0300 Message-Id: <200608141955.k7EJtNiE014364@beta.mvs.co.il> From: "Ehud Karni" To: knellis AT syntek-usa DOT com, cbrown13800 AT hotmail DOT com Cc: cygwin AT cygwin DOT com Subject: Re: ssh breaks while loop In-reply-to: <017301c6bfa9$25180ff0$9d32000a@idirect.net> (message from Kenneth Nellis on Mon, 14 Aug 2006 09:54:21 -0400) Reply-to: ehud AT unix DOT mvs DOT co DOT il References: <017301c6bfa9$25180ff0$9d32000a AT idirect DOT net> X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8-i Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 Mon, 14 Aug 2006 09:54:21 -0400, Kenneth Nellis wrote: > > FWIW, I see the same behavior, but not just Cygwin, but also on > a Red Hat Linux installation, so I guess it's more of a bash/ssh > issue than one with Cygwin. There are 2 issues here, One is ssh's, the other is with sh/bash. None is Cygwin specific, i.e. it is OFFTOPIC. On Friday, August 04, 2006 10:01 AM, BC wrote: BC> If file hostlist contains: BC> hosta BC> hostb BC> hostc BC> BC> then execute this shell script: BC> while read host BC> do BC> ssh $host ls -al .profile BC> done < hostlist BC> BC> the while loop executes one time and quits. The problem is that `ssh' read stdin. To overcome this change it to: ssh $host ls -al .profile < /dev/null A second possible problem is that ssh may exit with error, the solution is to add set +e (in separate line) before the ssh line. Ehud. -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D Better Safe Than Sorry -- 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/