Say I have a bash function:
run_stuff(){
if is_in_script; then
exit 1
fi
return 1;
}
basically, if I am running it in a script:
$ ./my-script.sh
then I want to exit with 1, but if I am running it directly in the terminal:
$ run_stuff
then I want to return 1 (o/w my terminal window will close)
what is the best way to check this cross-platform?