0
0
mirror of https://github.com/tj/n.git synced 2024-11-28 21:22:03 +01:00

Fixed bash specific substitutions. Closes #1

This commit is contained in:
Tj Holowaychuk 2011-01-20 18:26:03 -08:00
parent 28700f9bd2
commit 6905c29b73

12
bin/n
View File

@ -88,7 +88,7 @@ display_n_version() {
check_current_version() {
if test `which node`; then
active=`node --version`
active=${active/v/}
active=${active#v}
fi
}
@ -119,7 +119,7 @@ install_node() {
check_current_version
# remove "v"
version=${version/v/}
version=${version#v}
# already active
test "$version" = "$active" && return
@ -170,7 +170,7 @@ cleanup() {
#
remove_version() {
local version=${1/v/}
local version=${1#v}
test $# -eq 0 && abort "version(s) required"
while test $# -ne 0; do
rm -rf $VERSIONS_DIR/$version
@ -183,7 +183,7 @@ remove_version() {
#
display_bin_path_for_version() {
local version=${1/v/}
local version=${1#v}
test -z $1 && abort "version required"
local bin=$VERSIONS_DIR/$version/bin/node
if test -f $bin; then
@ -199,7 +199,7 @@ display_bin_path_for_version() {
#
execute_with_version() {
local version=${1/v/}
local version=${1#v}
test -z $1 && abort "version required"
local bin=$VERSIONS_DIR/$version/bin/node
if test -f $bin; then
@ -225,4 +225,4 @@ else
esac
shift
done
fi
fi