Merge pull request #479 from koenpunt/fix-args-replacement

string replacement turns out not POSIX compliant
master
Jordan Harband 2014-07-18 13:15:13 -07:00
commit fafbeb8c59
2 changed files with 12 additions and 14 deletions

View File

@ -16,13 +16,12 @@ nvm_download() {
curl $*
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS="$*"
ARGS=${ARGS/--progress-bar /--progress=bar }
ARGS=${ARGS/-L /}
ARGS=${ARGS/-I /}
ARGS=${ARGS/-s /-q }
ARGS=${ARGS/-o /-O }
ARGS=${ARGS/-C - /-c }
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \
-e 's/-I //' \
-e 's/-s /-q /' \
-e 's/-o /-O /' \
-e 's/-C - /-c /')
wget $ARGS
fi
}

13
nvm.sh
View File

@ -17,13 +17,12 @@ nvm_download() {
curl $*
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS="$*"
ARGS=${ARGS/--progress-bar /--progress=bar }
ARGS=${ARGS/-L /}
ARGS=${ARGS/-I /}
ARGS=${ARGS/-s /-q }
ARGS=${ARGS/-o /-O }
ARGS=${ARGS/-C - /-c }
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \
-e 's/-I //' \
-e 's/-s /-q /' \
-e 's/-o /-O /' \
-e 's/-C - /-c /')
wget $ARGS
fi
}