The script is actually loaded trough . ./.nvm/nvm.sh or source ./.nvm/nvm.sh. The actual shell used is the current shell of the user, because a function definition in a subshell will not be available to the top level shell. I found the shebang confusing because it seems as if the script is ready to be executed in the sh shell. Many users have bash or zsh as their default and the script is not executed in sh at all. Removing the shebang is removing misinformation, related: https://github.com/creationix/nvm/pull/270