mirror of
https://github.com/iridakos/goto.git
synced 2024-05-11 05:55:16 +00:00
check for if the script is on windows
Issue Windows support https://github.com/iridakos/goto/issues/43
This commit is contained in:
@@ -26,14 +26,25 @@ function _goto_install_error()
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
#windows check
|
||||
ON_WINDOWS=false
|
||||
if [[ "$OSTYPE" == "msys" ]]; then
|
||||
ON_WINDOWS=true
|
||||
fi
|
||||
|
||||
# sudo-check
|
||||
if [ $EUID -ne 0 ]; then
|
||||
if [ $EUID -ne 0 ] && [ "$ON_WINDOWS" == false ]; then
|
||||
_goto_install_error 'Please run this script in sudo mode or as root user'
|
||||
exit
|
||||
fi
|
||||
|
||||
HOME=$(eval echo "~${SUDO_USER}")
|
||||
if [[ $ON_WINDOWS = true ]]; then
|
||||
GOTO_FILE_LOCATION='/usr/bin/goto.sh'
|
||||
else
|
||||
GOTO_FILE_LOCATION='/usr/local/share/goto.sh'
|
||||
fi
|
||||
|
||||
RC=""
|
||||
if [ -f ~/.bashrc ]; then
|
||||
RC="$HOME/.bashrc"
|
||||
|
||||
Reference in New Issue
Block a user