diff options
| author | jesse <jesse@magic-kingdom> | 2026-03-15 18:40:33 +0000 |
|---|---|---|
| committer | jesse <jesse@magic-kingdom> | 2026-03-15 18:40:38 +0000 |
| commit | fd318b1b79caeac758f35b2653a4805790bbc39e (patch) | |
| tree | e6929509e878471aca4cbe4a084563a89072b384 /docs | |
| parent | ea472dedf070b15b2cbde1b63d7c1cac59681600 (diff) | |
fix(hooks): replace BASH_SOURCE with POSIX-safe $0
Replace ${BASH_SOURCE[0]:-$0} with $0 in hooks/session-start and the
polyglot-hooks docs example. BASH_SOURCE uses bash array syntax that
causes 'Bad substitution' on systems where /bin/sh is dash (Ubuntu).
Since session-start is always executed (never sourced), $0 and
BASH_SOURCE give the same result. Tested on Linux (bash + dash) and
Windows (Git Bash via CMD and direct).
Based on #553, closes #553.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/windows/polyglot-hooks.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/windows/polyglot-hooks.md b/docs/windows/polyglot-hooks.md index 6878f66..5e26ca4 100644 --- a/docs/windows/polyglot-hooks.md +++ b/docs/windows/polyglot-hooks.md @@ -148,7 +148,7 @@ exit /b CMDBLOCK # Unix shell runs from here -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_NAME="$1" shift "${SCRIPT_DIR}/${SCRIPT_NAME}" "$@" |
