Fix symlink resolution for SCRIPT_DIR in both scripts

Scripts now resolve symlinks before computing SCRIPT_DIR, so
they work correctly when invoked via ~/.local/bin/ symlinks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-07 14:06:50 -05:00
parent bbf242ef44
commit c0409579ac
2 changed files with 16 additions and 2 deletions

View File

@@ -4,7 +4,14 @@
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
# Resolve symlinks to find real script location
SOURCE="${BASH_SOURCE[0]}"
while [[ -L "$SOURCE" ]]; do
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
source "$SCRIPT_DIR/lib/frontmatter.sh"
SEARCH_ROOT="${HOME}/projects"