My bash script uses a lot of checks like:
if [ something bad ] ; then
echo "error message"
exit 1
fi
I have found out that if the user executes it via source my-script.sh rather than ./my-script.sh, this exit 1 closes the user's shell !
And the user sees no error message !
How do I know that the script is source-d, and how do I exit (with non-zero status code) the source-d script? In general, what can I do about this?