handle echo implementations that do not support `-e`

master
Fraser Tweedale 2014-02-21 22:10:17 +10:00
parent 21771e7369
commit ca0c8a7f1d
1 changed files with 5 additions and 2 deletions

7
nvm.sh
View File

@ -26,6 +26,9 @@ if [ ! -d "$NVM_DIR" ]; then
fi fi
fi fi
DASH_E=""
[ -z "$(echo -n -e)" ] && DASH_E="-e"
# Setup mirror location if not already set # Setup mirror location if not already set
if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
export NVM_NODEJS_ORG_MIRROR="http://nodejs.org/dist" export NVM_NODEJS_ORG_MIRROR="http://nodejs.org/dist"
@ -139,7 +142,7 @@ nvm_checksum() {
} }
colorize_version() { colorize_version() {
echo -e "\033[0;34m$1\033[0m" echo $DASH_E "\033[0;34m$1\033[0m"
} }
print_versions() { print_versions() {
@ -482,7 +485,7 @@ nvm() {
return return
;; ;;
"current" ) "current" )
echo -ne "current: \t"; nvm_version current echo $DASH_E -n "current: \t"; nvm_version current
;; ;;
"alias" ) "alias" )
mkdir -p $NVM_DIR/alias mkdir -p $NVM_DIR/alias