Ensure bash to be sourced or to be called as executable
if [ "${BASH_SOURCE[0]}" != "$0" ]; then
echo "This script intends to be called rather than be sourced"
return 1
fi
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
echo "This script intends to be sourced rather than be called"
exit 1
fi