mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-12 07:01:50 +00:00
Merge 192b2ecb1b
into 31c5406780
This commit is contained in:
commit
90f8ef5294
8
nvm.sh
8
nvm.sh
@ -19,8 +19,12 @@ fi
|
||||
|
||||
# Auto detect the NVM_DIR
|
||||
if [ ! -d "$NVM_DIR" ]; then
|
||||
if [ -n "$BASH_SOURCE" ]; then
|
||||
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname ${BASH_SOURCE[0]:-$0}) > /dev/null && pwd)
|
||||
if [ -n "${BASH_SOURCE}" ]; then
|
||||
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname $BASH_SOURCE) > /dev/null && pwd)
|
||||
elif [ "$(basename $0)" = nvm.sh ]; then
|
||||
# Works in shells that put the path of the sourcee into $0. Unfortunately
|
||||
# dash is not among these.
|
||||
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname $0) > /dev/null && pwd)
|
||||
else
|
||||
export NVM_DIR=$HOME/.nvm
|
||||
fi
|
||||
|
8
test/fast/$BASH_SOURCE should not be a problem in sh and zsh
Executable file
8
test/fast/$BASH_SOURCE should not be a problem in sh and zsh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo Testing bash
|
||||
bash -c '. ../../nvm.sh'
|
||||
echo Testing zsh
|
||||
zsh -c '. ../../nvm.sh'
|
||||
echo Testing sh
|
||||
sh -c '. ../../nvm.sh'
|
@ -0,0 +1,8 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# ~/.nvm must not be present
|
||||
. ../../nvm.sh
|
||||
|
||||
# Displays
|
||||
# find: ‘<home>/.nvm/’: No such file or directory
|
||||
# find: ‘<home>/.nvm/’: No such file or directory
|
Loading…
Reference in New Issue
Block a user