From 46cf9591e5ca476c992ba300d11417b504ac6b25 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sun, 31 Mar 2019 12:52:11 +0200 Subject: [PATCH] check if we can change to bashbot dir --- bashbot.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 0c45a26..ff4fb9c 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -10,7 +10,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.5-rc-0-g0c144bc +#### $$VERSION$$ v0.5-rc-1-g050d376 # are we runnig in a terminal? if [ -t 1 ] && [ "$TERM" != "" ]; then @@ -24,7 +24,11 @@ fi # get location of bashbot.sh an change to bashbot dir SCRIPT="./$(basename $0)" SCRIPTDIR="$(dirname $0)" -cd "${SCRIPTDIR}" || echo -e "${RED}ERROR: Can't change to ${SCRIPTDIR} ...${NC}" && exit 1 + +if ! cd "${SCRIPTDIR}" ; then + echo -e "${RED}ERROR: Can't change to ${SCRIPTDIR} ...${NC}" + exit 1 +fi if [ ! -w "." ]; then echo -e "${ORANGE}WARNING: $SCRIPTDIR is not writeable!${NC}"