`-o pipefail` is not without its gotchas
bash -eo pipefail -c "cat /etc/services | head -1; echo never got here" bash -eo pipefail -c "cat /etc/services | head -1; echo never got here"I find set -e also has some gotchas. '|| die' added to the end of each line is uglier but more obvious in many cases.
Where this will work as expected:
bash -eo pipefail -c "head < /etc/services -1|cat ; echo got here"