I have a script that is littered around my filesystem (side effect of a build process) that sets some global environment variables (LD_LIBRARY_PATH, PATH, ROOTDIR, etc) that need to be in my shell for proper operation. Of course, that means I need to source script.sh
or . script.sh
to get it to work, and not ./script.sh
(which would spawn a new shell and not set the variables in my current shell).
Is there anything I can add to the script to prevent (or warn) someone running ./script.sh
?