mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 04:48:22 +08:00
[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:
@@ -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-}" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user