[CentOS] Bash scripting - Remotely ran commands break while loop

Wed Feb 1 22:04:27 UTC 2012
Les Mikesell <lesmikesell at gmail.com>

On Wed, Feb 1, 2012 at 3:46 PM, Alexander Dalloz <ad+lists at uni-x.org> wrote:
> That has simply nothing to do with SSH. Compare following:
> echo "foo bar" | while read LINE; do echo $LINE; done
> and
> echo -e "foo\nbar" | while read $LINE; do echo $LINE; done

No, (a) that read $LINE should be read LINE and (b) echo "foo
bar" | something
should preserve the quoted newline.
Ssh does seem to be consuming stuff from the inherited piped stdin
even though it isn't obvious what it does with it in a non-interactive
scenario.  But anything that reads stdin inside the loop would cause
that (throw a 'cat >dev/null' in...).

   Les Mikesell
     lesmikesell at gmail.com