mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-02-04 17:02:48 +08:00
nvm.sh uses `NVM_SCRIPT_SOURCE="$_"` to detect its source location. Adding `: nvm.sh` before each source line ensures `$_` is set correctly, preventing breakage when the previous command (e.g., `set -ex`) overwrites it.
23 lines
420 B
Bash
Executable File
23 lines
420 B
Bash
Executable File
#!/bin/sh
|
|
|
|
: nvm.sh
|
|
\. ../../../nvm.sh
|
|
\. ../../common.sh
|
|
|
|
make_fake_node v0.0.2
|
|
make_fake_node v0.0.20
|
|
|
|
die () { echo "$@" ; exit 1; }
|
|
|
|
# The result should contain only the appropriate version numbers.
|
|
|
|
nvm ls 0.0.2 | grep 'v0.0.2' > /dev/null
|
|
if [ $? -eq 0 ]; then
|
|
echo '"nvm ls 0.0.2" contained v0.0.2'
|
|
fi
|
|
|
|
nvm ls 0.0.2 | grep 'v0.0.20' > /dev/null
|
|
if [ $? -eq 0 ]; then
|
|
die '"nvm ls 0.0.2" contained v0.0.20'
|
|
fi
|