On Thu, Mar 23, 2017 at 10:14:01PM -0700, Pádraig Brady wrote: > OK let's not derail this into a discussion specific to errexit. > Can we please improve things? > You say to not use errexit, and instead use `|| exit 1` where appropriate. > In that case can we fix this case? > > set -o pipefail > yes | head -n1 || exit 1 > echo this is skipped
What do you think is broken, here? imadev:~$ yes | head -n1 y imadev:~$ declare -p PIPESTATUS declare -a PIPESTATUS=([0]="141" [1]="0") I don't see any problem in bash's behavior. It's exiting because you asked it to exit if the pipe failed, and the pipe failed. The pipe failed because yes(1) returned a nonzero exit code, and you turned on the pipefail option. What exactly are you asking to change?