diff options
author | Tim Harder <radhermit@gmail.com> | 2016-01-16 13:56:50 -0500 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2016-01-16 13:56:50 -0500 |
commit | 2f5e9232fbf3ccd18354198ae57b695b40213f88 (patch) | |
tree | b800bcbaae2074c26351ffa321933ac754e197cf /shell | |
parent | esite: drop subshell for browser call (diff) | |
download | pkgcore-2f5e9232fbf3ccd18354198ae57b695b40213f88.tar.gz pkgcore-2f5e9232fbf3ccd18354198ae57b695b40213f88.tar.bz2 pkgcore-2f5e9232fbf3ccd18354198ae57b695b40213f88.zip |
shell: fix getting the current script path for both bash/zsh
Diffstat (limited to 'shell')
-rw-r--r-- | shell/pkgcore.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/shell/pkgcore.sh b/shell/pkgcore.sh index ed3a10a0..0dfd7615 100644 --- a/shell/pkgcore.sh +++ b/shell/pkgcore.sh @@ -9,7 +9,13 @@ if [[ ${PKGSHELL} != "bash" && ${PKGSHELL} != "zsh" ]]; then echo "$(basename ${0}): unsupported shell: ${PKGSHELL}" >&2 exit 1 fi -source "$(dirname ${0})/${PKGSHELL}/pkgcore.${PKGSHELL}" + +if [[ ${PKGSHELL} == "bash" ]]; then + SCRIPTDIR=$(dirname ${BASH_SOURCE[0]}) +else + SCRIPTDIR=$(dirname ${(%):-%N}) +fi +source "${SCRIPTDIR}/${PKGSHELL}/pkgcore.${PKGSHELL}" export PATH="$(dirname ${0})"/bin:${PATH} |