Skip to content

Commit 3cd379c

Browse files
committed
Follow symlinks when looking for lib files
The previous logic would not handle the case when the executed 'git-hub' script itself was a symlink.
1 parent 41f61f3 commit 3cd379c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/git-hub

+9-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ x Debug - Turn on Bash trace (set -x) output
6262
"
6363

6464
# source bash+ :std
65-
SELFDIR="$(cd -P `dirname $BASH_SOURCE` && pwd -P)"
65+
SELFFILE="$BASH_SOURCE"
66+
while [ -h "$SELFFILE" ]; do
67+
SELFDIR=$(cd -P "$(dirname "$SELFFILE")" && pwd -P)
68+
SELFFILE=$(readlink "$SELFFILE")
69+
if [ "${SELFFILE:0:1}" != "/" ]; then
70+
SELFFILE="$SELFDIR/$SELFFILE"
71+
fi
72+
done
73+
SELFDIR=$(cd -P $(dirname "$SELFFILE") && pwd -P)
6674
source "$SELFDIR/git-hub.d/bash+.bash"
6775
bash+:import :std can
6876

0 commit comments

Comments
 (0)