From b6ada31e46a9345ee69ad8a807cd406a8f8897f7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 24 Mar 2020 08:41:33 +0100 Subject: b4: allow b4.sh to be symlinked to Change b4.sh to handle being symlinked to in order to find out where it "lives". This allows me to have a symlink in my local ~/bin/ called b4 that links to the git repo's b4.sh and have everything work properly. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Konstantin Ryabitsev --- b4.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'b4.sh') diff --git a/b4.sh b/b4.sh index cafeee1..e1f6c4e 100755 --- a/b4.sh +++ b/b4.sh @@ -3,6 +3,7 @@ # Run b4 from a git checkout. # -SCRIPT_TOP="${SCRIPT_TOP:-$(cd "${BASH_SOURCE%/*}" && pwd)}" +REAL_SCRIPT=$(realpath -e ${BASH_SOURCE[0]}) +SCRIPT_TOP="${SCRIPT_TOP:-$(dirname ${REAL_SCRIPT})}" exec env PYTHONPATH="${SCRIPT_TOP}" python3 "${SCRIPT_TOP}/b4/command.py" "${@}" -- cgit v1.2.3