Philippe Torche wrote:
> The following script use eval with 3 pipes, 1st time with direct pipe on
> the command line, and the 2nd time with a pipe in a variable.
> In this second eval, the PIPESTATUS does not content 3 entries, but only 2.
>
> cat <<'EOF' > eval_pipe.sh
> #!/bin/env bash
> set -u
>
> eval echo 'titi' | grep toto | grep titi
> ret_codes=(${PIPESTATUS[*]})
> echo ret_codes=${ret_codes[*]}
> aPipe='|'
> eval echo 'titi' $aPipe grep toto | grep titi
> ret_codes=(${PIPESTATUS[*]})
I'd argue that this is, in fact, a two-element pipeline:
`eval echo 'titi' $aPipe grep toto' and `grep titi'.
When this completes, PIPESTATUS should contain two elements, as you
found.
The first command will eventually decompose into an additional two-stage
pipeline, which will set PIPESTATUS itself. That setting will happen in
a subshell, and would subsequently be overwritten anyway.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://tiswww.tis.case.edu/~chet/
_______________________________________________
Bug-bash mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-bash