[Robustness] avoid a set -u error when $_ is unset

Sourcing nvm.sh under `set -u` on a POSIX shell that leaves `$_` unset (e.g. busybox ash or dash on Alpine, where the parent shell does not export it) aborted at `NVM_SCRIPT_SOURCE="$_"`.
Default to empty; the only consumer already falls back to `$0`.
This commit is contained in:
Jordan Harband
2026-07-14 23:16:39 -07:00
parent 86c937436d
commit f1e7a84cb5
+1 -1
View File
@@ -11,7 +11,7 @@
{ # this ensures the entire script is downloaded # { # this ensures the entire script is downloaded #
# shellcheck disable=SC3028 # shellcheck disable=SC3028
NVM_SCRIPT_SOURCE="$_" NVM_SCRIPT_SOURCE="${_:-}"
nvm_is_zsh() { nvm_is_zsh() {
[ -n "${ZSH_VERSION-}" ] [ -n "${ZSH_VERSION-}" ]