mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-10-11 00:00:13 +08:00
`IFS=... nvm "$@"` is a prefix assignment to a function call, which bash's POSIX mode (macOS `/bin/sh`) keeps after the call returns, and exports.
20 lines
366 B
Bash
Executable File
20 lines
366 B
Bash
Executable File
#!/bin/sh
|
|
|
|
die () { IFS=' '; echo "$@" ; exit 1; }
|
|
|
|
: nvm.sh
|
|
\. ../../nvm.sh
|
|
|
|
IFS=':'
|
|
nvm --version >/dev/null
|
|
[ "${IFS}" = ':' ] || die "nvm changed the caller's IFS; got >${IFS}<"
|
|
|
|
set -e
|
|
nvm --version >/dev/null
|
|
set +e
|
|
[ "${IFS}" = ':' ] || die "nvm changed the caller's IFS under set -e; got >${IFS}<"
|
|
|
|
! env | grep -q '^IFS=' || die 'nvm exported IFS'
|
|
|
|
IFS=' '
|