[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bad PIPESTATUS when using eval with a pipe stored in a variable
From: |
Philippe Torche |
Subject: |
Bad PIPESTATUS when using eval with a pipe stored in a variable |
Date: |
Wed, 29 Jun 2005 23:27:18 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
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[*]})
echo ret_codes=${ret_codes[*]}
EOF
chmod +x eval_pipe.sh
eval_pipe.sh
<<<<<<<<<<
ret_codes=0 1 1
ret_codes=1 1
>>>>>>>>>>
Could be reproduce with bash version 2.05b (all patch applied) on Tru64
Unix 5.1A, version 2.05b.0(1)-release on cygwin, ...
- Bad PIPESTATUS when using eval with a pipe stored in a variable,
Philippe Torche <=