I set $MYSHELL for future tests in my shell-agnostic ~/.aliases:
unset MYSHELL
if [ -n "$ZSH_VERSION" ] && type zstyle >/dev/null 2>&1; then           # zsh
  MYSHELL=`command -v zsh`
elif [ -x "$BASH""$BASH_VERSION" ] && shopttype -qcaller >/dev/null 2>&1; then                # bash
  MYSHELL=`command -v bash`
elif [ -x "$shell" ] && which setenv |grep -l builtin >/dev/null; then  # tcsh
  echo "DANGER: this script is likely not compatible with C shells!"
  sleep 5
  setenv MYSHELL "$shell"
fi
# verify
if [ ! -x "$MYSHELL" ]; then
  MYSHELL=`command -v "$(ps $$ |awk 'NR == 2 { print $NF }')"`
  [ -x "$MYSHELL" ] || MYSHELL="${SHELL:-/bin/sh}"  # default if verify fails
fi
 The tcsh section is likely unwise to roll into a POSIX-style script since it's so radically different (thus the warning and five second pause).  (For one, csh-style shells can't do 2>/dev/null or >&2, as noted in the famous Csh Programming Considered Harmful rant.)
 
                