mirror of
https://github.com/iridakos/goto.git
synced 2025-05-16 07:20:17 -07:00
Fix indentation
This commit is contained in:
parent
2dde2ed274
commit
34a08a4bee
61
install
61
install
@ -26,37 +26,36 @@ function _goto_install_error()
|
|||||||
echo "$@" >&2
|
echo "$@" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# sudo-check
|
# sudo-check
|
||||||
if [ $EUID -ne 0 ]; then
|
if [ $EUID -ne 0 ]; then
|
||||||
_goto_install_error 'Please run this script in sudo mode or as root user'
|
_goto_install_error 'Please run this script in sudo mode or as root user'
|
||||||
exit
|
exit
|
||||||
fi
|
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
|
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
GOTO_FILE_LOCATION='/usr/local/share/goto.bash'
|
||||||
source "$GOTO_FILE_LOCATION"
|
RC=""
|
||||||
else
|
if [ -f ~/.bashrc ]; then
|
||||||
_goto_install_error "Error sourcing goto in your startup file.."
|
RC="$HOME/.bashrc"
|
||||||
_goto_install_error "E.g ~/.bashrc ~/.cshrc etc.."
|
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
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user