Merge pull request #259 from jsatt/master
Handle cases where grep is aliased to change outputmaster
commit
7fb6d1ec6a
18
nvm.sh
18
nvm.sh
|
@ -93,15 +93,15 @@ nvm_ls_remote() {
|
||||||
local PATTERN=$1
|
local PATTERN=$1
|
||||||
local VERSIONS
|
local VERSIONS
|
||||||
if [ "$PATTERN" ]; then
|
if [ "$PATTERN" ]; then
|
||||||
if echo "${PATTERN}" | grep -v '^v' ; then
|
if echo "${PATTERN}" | \grep -v '^v' ; then
|
||||||
PATTERN=v$PATTERN
|
PATTERN=v$PATTERN
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PATTERN=".*"
|
PATTERN=".*"
|
||||||
fi
|
fi
|
||||||
VERSIONS=`curl -s http://nodejs.org/dist/ \
|
VERSIONS=`curl -s http://nodejs.org/dist/ \
|
||||||
| egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' \
|
| \egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' \
|
||||||
| grep -w "${PATTERN}" \
|
| \grep -w "${PATTERN}" \
|
||||||
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
| sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n`
|
||||||
if [ ! "$VERSIONS" ]; then
|
if [ ! "$VERSIONS" ]; then
|
||||||
echo "N/A"
|
echo "N/A"
|
||||||
|
@ -253,7 +253,7 @@ nvm() {
|
||||||
if [ $binavail -eq 1 ]; then
|
if [ $binavail -eq 1 ]; then
|
||||||
t="$VERSION-$os-$arch"
|
t="$VERSION-$os-$arch"
|
||||||
url="http://nodejs.org/dist/$VERSION/node-${t}.tar.gz"
|
url="http://nodejs.org/dist/$VERSION/node-${t}.tar.gz"
|
||||||
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-${t}.tar.gz | awk '{print $1}'`
|
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | \grep node-${t}.tar.gz | awk '{print $1}'`
|
||||||
local tmpdir="$NVM_DIR/bin/node-${t}"
|
local tmpdir="$NVM_DIR/bin/node-${t}"
|
||||||
local tmptarball="$tmpdir/node-${t}.tar.gz"
|
local tmptarball="$tmpdir/node-${t}.tar.gz"
|
||||||
if (
|
if (
|
||||||
|
@ -285,10 +285,10 @@ nvm() {
|
||||||
fi
|
fi
|
||||||
local tmpdir="$NVM_DIR/src"
|
local tmpdir="$NVM_DIR/src"
|
||||||
local tmptarball="$tmpdir/node-$VERSION.tar.gz"
|
local tmptarball="$tmpdir/node-$VERSION.tar.gz"
|
||||||
if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | \grep '200 OK'`" != '' ]; then
|
||||||
tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz"
|
tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz"
|
||||||
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | grep node-$VERSION.tar.gz | awk '{print $1}'`
|
sum=`curl -s http://nodejs.org/dist/$VERSION/SHASUMS.txt | \grep node-$VERSION.tar.gz | awk '{print $1}'`
|
||||||
elif [ "`curl -Is "http://nodejs.org/dist/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then
|
elif [ "`curl -Is "http://nodejs.org/dist/node-$VERSION.tar.gz" | \grep '200 OK'`" != '' ]; then
|
||||||
tarball="http://nodejs.org/dist/node-$VERSION.tar.gz"
|
tarball="http://nodejs.org/dist/node-$VERSION.tar.gz"
|
||||||
fi
|
fi
|
||||||
if (
|
if (
|
||||||
|
@ -348,7 +348,7 @@ nvm() {
|
||||||
echo "Uninstalled node $VERSION"
|
echo "Uninstalled node $VERSION"
|
||||||
|
|
||||||
# Rm any aliases that point to uninstalled version.
|
# Rm any aliases that point to uninstalled version.
|
||||||
for A in `grep -l $VERSION $NVM_DIR/alias/* 2>/dev/null`
|
for A in `\grep -l $VERSION $NVM_DIR/alias/* 2>/dev/null`
|
||||||
do
|
do
|
||||||
nvm unalias `basename $A`
|
nvm unalias `basename $A`
|
||||||
done
|
done
|
||||||
|
@ -481,7 +481,7 @@ nvm() {
|
||||||
fi
|
fi
|
||||||
VERSION=`nvm_version $2`
|
VERSION=`nvm_version $2`
|
||||||
ROOT=`nvm use $VERSION && npm -g root`
|
ROOT=`nvm use $VERSION && npm -g root`
|
||||||
INSTALLS=`nvm use $VERSION > /dev/null && npm -g -p ll | grep "$ROOT\/[^/]\+$" | cut -d '/' -f 8 | cut -d ":" -f 2 | grep -v npm | tr "\n" " "`
|
INSTALLS=`nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d '/' -f 8 | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "`
|
||||||
npm install -g $INSTALLS
|
npm install -g $INSTALLS
|
||||||
;;
|
;;
|
||||||
"clear-cache" )
|
"clear-cache" )
|
||||||
|
|
Loading…
Reference in New Issue