From e58daba84e20a1a09662ab08c5287b550de2fb34 Mon Sep 17 00:00:00 2001
From: nkakouros <nkak@kth.se>
Date: Mon, 24 May 2021 21:43:56 +0200
Subject: [PATCH] Update headstart-core.bash

Co-authored by: mehes-kth <mehes@kth.se>
---
 headstart-core.bash | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/headstart-core.bash b/headstart-core.bash
index 1e45501..2853265 100644
--- a/headstart-core.bash
+++ b/headstart-core.bash
@@ -8,12 +8,15 @@
 # Path to the project's root directory
 declare -gx PROJECT_DIR
 
+# The `SHELL` env variable is not supported by every shell and bash sets it
+# only if it is not set already. To be sure it exists, it is set here.
+[[ ! -v BASH ]] || export SHELL=$BASH
+
 # Used for testing
 if [[ -v PROJECT_DIR ]]; then
   PROJECT_DIR="$PROJECT_DIR"
 else
-  cd "${0%/*}" || exit "$_HEADSTART_EC_GENERR"
-  PROJECT_DIR="$PWD"
+  declare -gx PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
 fi
 
 if [[ ! -v _HEADSTART_SCRIPT_NAME ]]; then  # tests may set this directly
-- 
GitLab