[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on piping commands from stdin atop 20110822
From: |
Jay Hacker |
Subject: |
Re: Question on piping commands from stdin atop 20110822 |
Date: |
Thu, 8 Sep 2011 14:27:36 -0400 |
Rhys,
If you use ::: then parallel doesn't read commands from stdin (the
first process gets stdin).
The idiomatic way to do it is:
cat <<HERE | parallel echo
foo
bar
baz
HERE
Otherwise, if you don't give parallel any command as an argument, you
need to give it whole commands on stdin:
cat <<HERE | parallel
echo foo
echo bar
echo baz
HERE
On Thu, Sep 8, 2011 at 11:07 AM, Rhys Ulerich <rhys.ulerich@gmail.com> wrote:
> If I understand parallel correctly, I expect the following two
> commands to give identical results:
>
> cat <<HERE | sh
> echo foo
> echo bar
> echo baz
> HERE
>
> cat <<HERE | parallel ::: foo bar baz
> echo {}
> HERE
>
> while using version 20110822 the first produces "foo\nbar\nbaz" as
> expected while the second emits bash errors.
>
> cat <<HERE | parallel --dry-run ::: foo bar baz
> echo {}
> HERE
>
> shows commands like
>
> nice -n10 bash -c foo
> nice -n10 bash -c bar
> nice -n10 bash -c baz
>
> on my system (where I always enable niceness in my rc file).
>
> Am I misunderstanding the behavior of piped input commands?
>
> Thanks,
> Rhys
>
>