I have a script
#! /bin/sh
set -eux
command_a
command_b | command_c
while [ true ]; do
command_d
done
I'd like this to fail when any command fails. If command_a fails, the script fails, but if command_b or command_d (not sure about command_c) fail, the script carries on.
pipefailoption to that also,set -euxo pipefailwhile true; doinstead ofwhile [ true ]; do-- the latter implies thatwhile [ false ]; dowould behave differently, which it doesn't.