From 34a08a4bee376b1bfe08ac6868cf58f0acbb4e9b Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Mon, 12 Mar 2018 08:13:38 +0200 Subject: [PATCH] Fix indentation --- install | 61 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/install b/install index 435cb56..7a981d0 100755 --- a/install +++ b/install @@ -26,37 +26,36 @@ function _goto_install_error() echo "$@" >&2 } - # sudo-check - if [ $EUID -ne 0 ]; then - _goto_install_error 'Please run this script in sudo mode or as root user' - exit - fi - - GOTO_FILE_LOCATION='/usr/local/share/goto.bash' - RC="" - if [ -f ~/.bashrc ]; then - RC="$HOME/.bashrc" - elif [ -f ~/.cshrc ]; then - RC="$HOME/.cshrc" - elif [ -f ~/.kshrc ]; then - RC="$HOME/.kshrc" - elif [ -f ~/.zshrc ]; then - RC="$HOME/.zshrc" - fi - - cp ./goto.bash "$GOTO_FILE_LOCATION" - - if [ -n "$RC" ]; then - # Append source to RC startup file if not already there - if [ "$(grep -c "source $GOTO_FILE_LOCATION" "$RC")" == "0" ]; then - # Append source to RC file - echo -e "\\n#Source goto\\nsource $GOTO_FILE_LOCATION\\n" >> "$RC" - fi +# sudo-check +if [ $EUID -ne 0 ]; then + _goto_install_error 'Please run this script in sudo mode or as root user' + exit +fi - # shellcheck source=/dev/null - source "$GOTO_FILE_LOCATION" - else - _goto_install_error "Error sourcing goto in your startup file.." - _goto_install_error "E.g ~/.bashrc ~/.cshrc etc.." +GOTO_FILE_LOCATION='/usr/local/share/goto.bash' +RC="" +if [ -f ~/.bashrc ]; then + RC="$HOME/.bashrc" +elif [ -f ~/.cshrc ]; then + RC="$HOME/.cshrc" +elif [ -f ~/.kshrc ]; then + RC="$HOME/.kshrc" +elif [ -f ~/.zshrc ]; then + RC="$HOME/.zshrc" +fi + +cp ./goto.bash "$GOTO_FILE_LOCATION" + +if [ -n "$RC" ]; then + # Append source to RC startup file if not already there + if [ "$(grep -c "source $GOTO_FILE_LOCATION" "$RC")" == "0" ]; then + # Append source to RC file + echo -e "\\n#Source goto\\nsource $GOTO_FILE_LOCATION\\n" >> "$RC" fi + # shellcheck source=/dev/null + source "$GOTO_FILE_LOCATION" +else + _goto_install_error "Error sourcing goto in your startup file.." + _goto_install_error "E.g ~/.bashrc ~/.cshrc etc.." +fi