Not every shell has the "source" command. For example, in Dash (default for Ubuntu "sh"), the "./" is required in front of the filename.
. ./not_bash.sh
# source it or copy it into your script to avoid invoking a different shell. That's why there's no shebang. | |
case "$(type declare)" in | |
"declare is a shell builtin") echo bash;; | |
"declare is a reserved word") echo zsh;; | |
esac |
# source it or copy it into your script to avoid invoking a different shell. That's why there's no shebang. | |
case "$(type declare)" in | |
"declare is a shell builtin") ;; | |
*) echo "Please use Bash shell"; return 1;; | |
esac |