Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/local/nvm/test/sourcing/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/nvm/test/sourcing/Sourcing nvm.sh with --install should install the default
#!/bin/sh

die () { echo $@ ; exit 1; }
supports_source_options () {
  [ "_$(echo 'echo $1' | . /dev/stdin yes)" = "_yes" ]
}

if ! supports_source_options; then
  echo 'this shell does not support passing options on sourcing'
  exit 0;
fi

echo '0.10.2' > ../../alias/default || die 'creation of default alias failed'

echo 'sourcing nvm with --install...'

. ../../nvm.sh --install
EXIT_CODE="$(echo $?)"

echo 'sourcing complete.'

nvm_version 0.10.2 >/dev/null 2>&1 || die "v0.10.2 not installed: $(nvm ls)"

[ "_$EXIT_CODE" = "_0" ] || die "sourcing returned nonzero exit code: $EXIT_CODE"

NVM_LS_CURRENT="$(nvm ls current | \grep -o v0.10.2)"
[ "_$NVM_LS_CURRENT" = '_v0.10.2' ] || die "'nvm ls current' did not return '-> v0.10.2', got '$NVM_LS_CURRENT'"

NVM_ALIAS_DEFAULT="$(nvm alias default)"
[ "_$NVM_ALIAS_DEFAULT" = "_default -> 0.10.2 (-> v0.10.2)" ] \
  || die "'nvm alias default did not return 'default -> 0.10.2 (-> v0.10.2)', got '$NVM_ALIAS_DEFAULT'"


Hry