Using env var $SHELL is fragile when used to determine the current shell. For example, a user with '/bin/sh' login shell sources loadLSST.sh within a bash subprocess and the env var $SHELL remains /bin/sh
A more robust method:
This was seen in a batch environment where spawning subprocesses is typical, as opposed to a user laptop environment. Our workaround was to override $SHELL.