sourcing a Bash script - Return on Error, instead of Exit?
Simply source the file with a failsafe:
source the-source-file || true
... then the overall command won't fail, even if source
does.
This is the only thing that works for what I needed to accomplish (creating a virtual environment then activating it, then installing requirements from a bash script):
spawn a subshell / child shell from the script, as in:
stupid_file.sh
(
set -o errexit
#bunch of commands
#one line fails
)
run the stupid_file using:
source stupid_file.sh <file arguments here> || true
THE END.
** takes a bow **
(credit goes to Jeff and Terdon)