www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/14/15:55:38

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" <ehud AT unix DOT mvs DOT co DOT il>
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
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 <http://www.keyserver.net/>    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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019