Bash scripting - Remotely ran commands break while loop
On Wed, Feb 1, 2012 at 3:46 PM, Alexander Dalloz <firstname.lastname@example.org> wrote:
> That has simply nothing to do with SSH. Compare following:
> echo "foo bar" | while read LINE; do echo $LINE; done
> echo -e "foo
bar" | 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...).
CentOS mailing list