From 1fac49f887596b242c06eabd90884baadf412821 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sun, 22 Dec 2013 17:56:42 +0100 Subject: [PATCH] replaced undocumented option for specifying the profile as first argument to specifying it as a environment variable (eg: PROFILE=~/.myprofile ./install-gitless.sh) also; fixed indentation and added .zshrc as possible profile --- install-gitless.sh | 8 ++++---- install.sh | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/install-gitless.sh b/install-gitless.sh index 2603ad9..a0e524b 100755 --- a/install-gitless.sh +++ b/install-gitless.sh @@ -31,12 +31,12 @@ echo "Downloaded" echo -# Detect profile file, .bash_profile has precedence over .profile -if [ ! -z "$1" ]; then - PROFILE="$1" -else +# Detect profile file if not specified as environment variable (eg: PROFILE=~/.myprofile). +if [ -z "$PROFILE" ]; then if [ -f "$HOME/.bash_profile" ]; then PROFILE="$HOME/.bash_profile" + elif [ -f "$HOME/.zshrc" ]; then + PROFILE="$HOME/.zshrc" elif [ -f "$HOME/.profile" ]; then PROFILE="$HOME/.profile" fi diff --git a/install.sh b/install.sh index c69c149..d9c4579 100755 --- a/install.sh +++ b/install.sh @@ -28,16 +28,14 @@ fi echo -# Detect profile file, .bash_profile has precedence over .profile -if [ ! -z "$1" ]; then - PROFILE="$1" -else +# Detect profile file if not specified as environment variable (eg: PROFILE=~/.myprofile). +if [ ! "$PROFILE" ]; then if [ -f "$HOME/.bash_profile" ]; then - PROFILE="$HOME/.bash_profile" + PROFILE="$HOME/.bash_profile" elif [ -f "$HOME/.zshrc" ]; then - PROFILE="$HOME/.zshrc" + PROFILE="$HOME/.zshrc" elif [ -f "$HOME/.profile" ]; then - PROFILE="$HOME/.profile" + PROFILE="$HOME/.profile" fi fi