I am trying to get rid of an exit call in a bash script in order to make it sourceable.
At this moment the script contains an exit which is ok if you call the script normally, but if you source it, it will also stop the execution of the calling script which is not desired.
If I replace the exit with a return it will work well when source but it will fail with an error when is not sourced.
return: can only `return' from a function or sourced script
I am looking at a solution what would work with both cases.