Hi,
The following example returns the exit status of the last command in a
pipe. I'm wondering if there is a way to inherent non-zero exit status
using pipe. That is, if there is any command in a pipe that return a
non-zero status, I'd like the whole pipe return a non-zero status.
$ cat main.sh
On Wed, Aug 11, 2010 at 2:18 PM, Peng Yu pengyu...@gmail.com wrote:
Hi,
The following example returns the exit status of the last command in a
pipe. I'm wondering if there is a way to inherent non-zero exit status
using pipe. That is, if there is any command in a pipe that return a
non-zero
On 08/11/2010 05:20 AM, Pierre Gaston wrote:
On Wed, Aug 11, 2010 at 2:18 PM, Peng Yu pengyu...@gmail.com wrote:
Hi,
The following example returns the exit status of the last command in a
pipe. I'm wondering if there is a way to inherent non-zero exit status
using pipe. That is, if there is
On 08/11/2010 07:46 AM, Eric Blake wrote:
On 08/11/2010 05:20 AM, Pierre Gaston wrote:
On Wed, Aug 11, 2010 at 2:18 PM, Peng Yu pengyu...@gmail.com wrote:
Hi,
The following example returns the exit status of the last command in a
pipe. I'm wondering if there is a way to inherent non-zero
However, if your pipe is in a command substitution or other subshell,
PIPESTATUS won't be useful. You'll have to use pipefail.
$ set +o pipefail
$ var=$(false | true)
$ declare -p PIPESTATUS# shows the status of the assignment, not the false
declare -a PIPESTATUS='([0]=0)'
$ var=$(false |