From 68c17b26dca9bc3afc3255652bc050ce82146838 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 24 Dec 2016 11:41:42 -0800 Subject: [PATCH] Bashisms Signed-off-by: Dan Schaper --- advanced/Scripts/update.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/update.sh b/advanced/Scripts/update.sh index ae73caa4..43210a28 100755 --- a/advanced/Scripts/update.sh +++ b/advanced/Scripts/update.sh @@ -22,13 +22,15 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole" is_repo() { # Use git to check if directory is currently under VCS, return the value local directory="${1}" + local curdir + local rc - curdir=$PWD - cd $directory + curdir="${PWD}" + cd "${directory}" || { echo "Unable to change to ${directory}, exiting."; exit 1; } git status --short &> /dev/null rc=$? - cd $curdir - return $rc + cd "${curdir}" || { echo "Unable to change to ${curdir}, exiting."; exit 1; } + return "${rc}" } prep_repo() {