I\'d like to return an exit code from a BASH script that is called within another script, but could also be called directly. It roughly looks like this:
You can use x"${BASH_SOURCE[0]}" == x"$0" to test if the script was sourced or called (false if sourced, true if called) and return or exit accordingly.