I'd like to be able to warn and fail if the following command expansion fails:
#!/usr/bin/env bash
set -Eeuo pipefail
echo "$(invalid_cmd)"
echo "$?"
Instead of failing, I get the following output:
./script.sh: line 5: invalid_cmd: command not found
0
echo "$(invalid_cmd)"withinvalid_cmd.