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" ] && shopt -q >/dev/null 2>&1; then              # bash
      MYSHELL=`command -v bash`
    elif which setenv ls-F 2>/dev/null |grep builtin >/dev/null; then  # tcsh
      echo "DANGER: this script is likely not compatible with C shells!" >&2
      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 will complain about the `2>/dev/null` since they have no equivalent, as noted in the famous [Csh Programming Considered Harmful](http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/) rant.)