DEV Community

Discussion on: Robust error handling in Bash

Collapse
 
dakusui profile image
Hiroshi Ukai • Edited

Thank you very much for a great post!
I found following still doesn't exit with the setting suggested in the post.

set -euo pipefail
shopt -s inherit_errexit nullglob

cat -n <(cat notFound) <(echo Hello)
echo "shouldn't be executed: $?"
Enter fullscreen mode Exit fullscreen mode

I think it is because the process substitution (<(cat notFound)) creates a sub-shell but it doesn't involve an assignment.
The example you mentioned (the command substitution without an assignment) can be avoided with an assignment to a dummy variable but I can't come up with a good workaround...