@@ -1261,17 +1261,17 @@ def main():
1261
1261
1262
1262
deactivate_node () {
1263
1263
# reset old environment variables
1264
- if [ -n "$_OLD_NODE_VIRTUAL_PATH" ] ; then
1265
- PATH="$_OLD_NODE_VIRTUAL_PATH"
1264
+ if [ -n "${ _OLD_NODE_VIRTUAL_PATH:-} " ] ; then
1265
+ PATH="${ _OLD_NODE_VIRTUAL_PATH:-} "
1266
1266
export PATH
1267
1267
unset _OLD_NODE_VIRTUAL_PATH
1268
1268
1269
- NODE_PATH="$_OLD_NODE_PATH"
1269
+ NODE_PATH="${ _OLD_NODE_PATH:-} "
1270
1270
export NODE_PATH
1271
1271
unset _OLD_NODE_PATH
1272
1272
1273
- NPM_CONFIG_PREFIX="$_OLD_NPM_CONFIG_PREFIX"
1274
- npm_config_prefix="$_OLD_npm_config_prefix"
1273
+ NPM_CONFIG_PREFIX="${ _OLD_NPM_CONFIG_PREFIX:-} "
1274
+ npm_config_prefix="${ _OLD_npm_config_prefix:-} "
1275
1275
export NPM_CONFIG_PREFIX
1276
1276
export npm_config_prefix
1277
1277
unset _OLD_NPM_CONFIG_PREFIX
@@ -1281,18 +1281,18 @@ def main():
1281
1281
# This should detect bash and zsh, which have a hash command that must
1282
1282
# be called to get it to forget past commands. Without forgetting
1283
1283
# past commands the $PATH changes we made may not be respected
1284
- if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
1284
+ if [ -n "${ BASH:-} " -o -n "${ ZSH_VERSION:-} " ] ; then
1285
1285
hash -r
1286
1286
fi
1287
1287
1288
- if [ -n "$_OLD_NODE_VIRTUAL_PS1" ] ; then
1289
- PS1="$_OLD_NODE_VIRTUAL_PS1"
1288
+ if [ -n "${ _OLD_NODE_VIRTUAL_PS1:-} " ] ; then
1289
+ PS1="${ _OLD_NODE_VIRTUAL_PS1:-} "
1290
1290
export PS1
1291
1291
unset _OLD_NODE_VIRTUAL_PS1
1292
1292
fi
1293
1293
1294
1294
unset NODE_VIRTUAL_ENV
1295
- if [ ! "$1 " = "nondestructive" ] ; then
1295
+ if [ ! "${1:-} " = "nondestructive" ] ; then
1296
1296
# Self destruct!
1297
1297
unset -f deactivate_node
1298
1298
fi
@@ -1306,7 +1306,7 @@ def main():
1306
1306
cut -d ' ' -f 1 | grep -v npm`
1307
1307
else
1308
1308
local npmls="npm ls -g"
1309
- if [ "$1 " = "-l" ]; then
1309
+ if [ "${1:-} " = "-l" ]; then
1310
1310
npmls="npm ls"
1311
1311
shift
1312
1312
fi
@@ -1326,7 +1326,7 @@ def main():
1326
1326
1327
1327
# find the directory of this script
1328
1328
# http://stackoverflow.com/a/246128
1329
- if [ "${BASH_SOURCE}" ] ; then
1329
+ if [ "${BASH_SOURCE:- }" ] ; then
1330
1330
SOURCE="${BASH_SOURCE[0]}"
1331
1331
1332
1332
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
@@ -1346,28 +1346,28 @@ def main():
1346
1346
PATH="$NODE_VIRTUAL_ENV/lib/node_modules/.bin:$NODE_VIRTUAL_ENV/__BIN_NAME__:$PATH"
1347
1347
export PATH
1348
1348
1349
- _OLD_NODE_PATH="$NODE_PATH"
1349
+ _OLD_NODE_PATH="${ NODE_PATH:-} "
1350
1350
NODE_PATH="$NODE_VIRTUAL_ENV/__MOD_NAME__"
1351
1351
export NODE_PATH
1352
1352
1353
- _OLD_NPM_CONFIG_PREFIX="$NPM_CONFIG_PREFIX"
1354
- _OLD_npm_config_prefix="$npm_config_prefix"
1353
+ _OLD_NPM_CONFIG_PREFIX="${ NPM_CONFIG_PREFIX:-} "
1354
+ _OLD_npm_config_prefix="${ npm_config_prefix:-} "
1355
1355
NPM_CONFIG_PREFIX="__NPM_CONFIG_PREFIX__"
1356
1356
npm_config_prefix="__NPM_CONFIG_PREFIX__"
1357
1357
export NPM_CONFIG_PREFIX
1358
1358
export npm_config_prefix
1359
1359
1360
- if [ -z "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
1361
- _OLD_NODE_VIRTUAL_PS1="$PS1"
1360
+ if [ -z "${ NODE_VIRTUAL_ENV_DISABLE_PROMPT:-} " ] ; then
1361
+ _OLD_NODE_VIRTUAL_PS1="${ PS1:-} "
1362
1362
if [ "x__NODE_VIRTUAL_PROMPT__" != x ] ; then
1363
- PS1="__NODE_VIRTUAL_PROMPT__ $PS1"
1363
+ PS1="__NODE_VIRTUAL_PROMPT__ ${ PS1:-} "
1364
1364
else
1365
1365
if [ "`basename \"$NODE_VIRTUAL_ENV\"`" = "__" ] ; then
1366
1366
# special case for Aspen magic directories
1367
1367
# see http://www.zetadev.com/software/aspen/
1368
- PS1="[`basename \`dirname \"$NODE_VIRTUAL_ENV\"\``] $PS1"
1368
+ PS1="[`basename \`dirname \"$NODE_VIRTUAL_ENV\"\``] ${ PS1:-} "
1369
1369
else
1370
- PS1="(`basename \"$NODE_VIRTUAL_ENV\"`) $PS1"
1370
+ PS1="(`basename \"$NODE_VIRTUAL_ENV\"`) ${ PS1:-} "
1371
1371
fi
1372
1372
fi
1373
1373
export PS1
@@ -1376,7 +1376,7 @@ def main():
1376
1376
# This should detect bash and zsh, which have a hash command that must
1377
1377
# be called to get it to forget past commands. Without forgetting
1378
1378
# past commands the $PATH changes we made may not be respected
1379
- if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
1379
+ if [ -n "${ BASH:-} " -o -n "${ ZSH_VERSION:-} " ] ; then
1380
1380
hash -r
1381
1381
fi
1382
1382
"""
0 commit comments