From 12e181c6f6167adabb688f63418037c8c1949335 Mon Sep 17 00:00:00 2001 From: Daniel Lockard Date: Wed, 4 Apr 2012 13:04:00 -0500 Subject: Added an if-statement to see if git is installed --- tools/install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/install.sh b/tools/install.sh index aedb706da..8ca427d2c 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -5,7 +5,13 @@ then fi echo "\033[0;34mCloning Oh My Zsh...\033[0m" -/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +which git > /dev/null +if [[ $? -eq 0 ]]; then + /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +else + echo "git not installed" + exit +fi echo "\033[0;34mLooking for an existing zsh config...\033[0m" if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] -- cgit v1.2.3-70-g09d2 From a39c9ffe5b7236b6e4dc78efa80b478cc411af7f Mon Sep 17 00:00:00 2001 From: Renan Cakirerk Date: Sat, 23 Jun 2012 14:53:40 +0300 Subject: Fix finding git issue. http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script --- tools/install.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/install.sh b/tools/install.sh index 8ca427d2c..b080be3a1 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -5,13 +5,10 @@ then fi echo "\033[0;34mCloning Oh My Zsh...\033[0m" -which git > /dev/null -if [[ $? -eq 0 ]]; then - /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh -else +hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || { echo "git not installed" exit -fi +} echo "\033[0;34mLooking for an existing zsh config...\033[0m" if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] -- cgit v1.2.3-70-g09d2