I'd like to run a series of commands inside part of a script, and stop if any return a non-zero exit status. But also, inside the same script, I'd like a final command to always run, regardless of whether anything failed before.
#!/usr/bin/env bash set -e ( # various commands go here ) &> /var/log/logfile final_command_that_always_runs /var/log/logfile
Is this possible?
Perhaps I can 'set -e' for only one () section of a script?