[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] dumb person's looping
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] dumb person's looping |
Date: |
Wed, 7 Jan 2015 09:47:51 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Jan 07, 2015 at 08:28:01AM -0600, address@hidden wrote:
> Would y'all explain in simple terms what is going wrong here
>
> while read l; do echo "checking ${l}"; ssh ${l} ls; done <list_of_servers
>
> After the first server the loop terminates
http://mywiki.wooledge.org/BashFAQ/089
Brief explanation: ssh and read are both reading from the same stdin
stream. ssh is greedy and grabs all the data. The wiki page shows
some workarounds.