Use a ZSH-compatible version of BASH_SOURCE[0]

This commit is contained in:
David Biancolin
2021-06-11 05:18:01 +00:00
parent b59ff89d60
commit e1965400f6
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -6,7 +6,9 @@
set -e
set -o pipefail
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
# If BASH_SOURCE is undefined, we may be running under zsh, in that case
# provide a zsh-compatible alternative
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"
CHIPYARD_DIR="$(dirname "$DIR")"
usage() {