advanced patterns when using 'set -e' in a bash script with subshells
I'm working with an scenario with my bash script where I'm using `set -e` to exit on errors, but it doesn't seem to work as expected in subshells. I'm on Ubuntu 22.04 and using bash version 5.1.4. Hereβs a simplified version of my script: ```bash #!/bin/bash set -e ( # Start subshell command_that_fails echo "This will not run if the previous command fails" ) echo "This will always run" ``` When `command_that_fails` fails, I expect the entire script to exit, but instead, it continues executing and prints "This will always run". I tried using `set -o pipefail` in addition to `set -e`, but it didnβt change the behavior. I am aware that `set -e` does not apply to subshells, but I was hoping to find a solution that allows me to enforce behavior handling more strictly. I've also checked the manual but couldn't find a definitive answer on how to manage this scenario effectively. Is there a way to ensure that the main script exits if a command in a subshell fails?