Skip to content

Commit

Permalink
Set TEAMTALK_ROOT correctly in zsh
Browse files Browse the repository at this point in the history
Fixes BASH_SOURCE being blank in zsh shell
  • Loading branch information
bear101 committed Dec 30, 2021
1 parent a7a9012 commit 1d59e6e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

# Find absolute path (that works on both macOS and Linux :( )
CURDIR=$PWD
TEAMTALK_ROOT=$(dirname ${BASH_SOURCE[0]})
ENVDIR="${BASH_SOURCE[0]}"
# zsh does not set BASH_SOURCE variable, so assume zsh if blank
if [ -z $ENVDIR ]; then
echo "BASH_SOURCE is blank so using zsh syntax"
ENVDIR=${0:a:h}
else
ENVDIR=$(dirname $ENVDIR)
fi
TEAMTALK_ROOT=$ENVDIR
cd $TEAMTALK_ROOT
TEAMTALK_ROOT=$(pwd -P)
cd $CURDIR
Expand Down

0 comments on commit 1d59e6e

Please sign in to comment.