[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] folder -nocreate +/this/does/not/exist
From: |
Ralph Corderoy |
Subject: |
Re: [Nmh-workers] folder -nocreate +/this/does/not/exist |
Date: |
Mon, 29 Aug 2016 16:08:26 +0100 |
Hi Norm,
> Confession: I have never fixed this problem:
>
> false|true
>
> Then true is run and the command does not return an error value.
Yes, the traditional exit status of a pipe is that of its last command.
bash has a pipefail shell option.
The return status of a pipeline is the exit status of the last
command, unless the pipefail option is enabled. If pipefail is
enabled, the pipeline's return status is the value of the last
(rightmost) command to exit with a non-zero status, or zero if all
commands exit successfully. If the reserved word ! precedes a
pipeline, the exit status of that pipeline is the logical negation
of the exit status as described above. The shell waits for all
commands in the pipeline to terminate before returning a value.
Thus
$ bash -c 'false | true; echo $?; set -o pipefail; false | true; echo $?'
0
1
$
My bash scripts start
set -eEu -o pipefail
shopt -s failglob
trap 'echo ${0##*/}: line $LINENO: unexpected exit: $? >&2' ERR
progname=${0##*/}
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
- [Nmh-workers] folder -nocreate +/this/does/not/exist, Ralph Corderoy, 2016/08/28
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, David Levine, 2016/08/28
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, Ralph Corderoy, 2016/08/29
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, David Levine, 2016/08/29
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, norm, 2016/08/29
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, Ralph Corderoy, 2016/08/29
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, norm, 2016/08/29
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist,
Ralph Corderoy <=
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, norm, 2016/08/29
- Re: [Nmh-workers] folder -nocreate +/this/does/not/exist, Ralph Corderoy, 2016/08/29