* Use $(..) instead of deprecated .., which can produce unknown behaviors on posix systems

* No need to change path when git cloning - use --quiet instead of redirecting stdout
This commit is contained in:
Ali Abbas
2014-03-29 16:34:57 +01:00
parent 391fd44838
commit 3554b6ae2a
+7 -6
View File
@@ -10,7 +10,7 @@ display_error() {
update_profile() {
[ -f $1 ] || return 1
cat $1 | grep "$source_line" > /dev/null 2>&1
grep "$source_line" "$1" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$source_line" >> $1
fi
@@ -52,13 +52,14 @@ fi
[ "$GVM_DEST" == "" ] && display_error "No destination specified!"
[ -d $GVM_DEST/$GVM_NAME ] && display_error "Already installed!"
[ -d $GVM_DEST ] || mkdir -p $GVM_DEST > /dev/null 2>&1 || display_error "Failed to create $GVM_DEST"
[ -z `which git` ] && display_error "Could not find git
[ -z "$(which git)" ] && display_error "Could not find git
linux: apt-get install git
debina/ubuntu: apt-get install git
redhat/centos: yum install git
mac: brew install git
"
cd $GVM_DEST && git clone $SRC_REPO $GVM_NAME > /dev/null 2>&1 ||
git clone --quiet $SRC_REPO "$GVM_DEST/$GVM_NAME" 2> /dev/null ||
display_error "Failed to clone from $SRC_REPO into $GVM_DEST/$GVM_NAME"
if [ "$BRANCH" != "" ]; then
@@ -78,9 +79,9 @@ fi
if [ -n "$ZSH_NAME" ]; then
update_profile $HOME/.zshrc
elif [ "`uname`" == "Linux" ]; then
elif [ "$(uname)" == "Linux" ]; then
update_profile $HOME/.bashrc || update_profile $HOME/.bash_profile
elif [ "`uname`" == "Darwin" ]; then
elif [ "$(uname)" == "Darwin" ]; then
update_profile $HOME/.profile || update_profile $HOME/.bash_profile
fi