[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] folder -nocreate +/this/does/not/exist

From: norm
Subject: Re: [Nmh-workers] folder -nocreate +/this/does/not/exist
Date: Mon, 29 Aug 2016 09:14:12 -0700

Ralph Corderoy <address@hidden> writes:
>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.

Thank you. I was unaware of that feature. I will try it on new scripts, though
I'm too cowardly to try it on existing scripts.

But even with that:

  false|rm -rf /

run as root would not be wise.:-)

That is, a whole pipeline will be run, even if a non-rightmost command exits
with an error return status.

    Norman Shapiro

reply via email to

[Prev in Thread] Current Thread [Next in Thread]