-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bash: cannot find track subdirectory #10
Comments
Perhaps something gross like if [[ -n $ZSH_VERSION ]]; then
_dir="$(dirname "$(readlink -f "$0")")"
elif [[ -n $BASH_VERSION ]]; then
_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
fi or if [[ -n $BASH_VERSION ]]; then
_script=${BASH_SOURCE[0]}
else
_script=$0
fi
_dir="$(dirname "$(readlink -f "${_script}")")"
unset _script |
Interesting incompatibility. Is Zsh the only one treating |
It seems this is something special that both bash and zsh do.
|
Alright, thanks for the research. Let's adopt the second solution for now, as it fixes the current problem. If someone uses Ksh, then let's wait for them to complain if |
Oops, I didn't see your comment before creating the PR. |
No problem! I was actually peeling and cutting up some vegetables, so I couldn't really do some more research... Fixing this is already great. Further improvements can always wait. |
In bash, when sourcing a file,
$0
is not the path of the file being sourced: that is the first element of the BASH_SOURCE array.If I add a debugging line into xr.sh:
Then:
The text was updated successfully, but these errors were encountered: