From 2a66d6bde94ffc4472ec5188f812903dc8780de6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 30 Mar 2012 14:56:19 -0700 Subject: [PATCH] Minor, correct arc handling of relative symlinking (from @makinde). --- bin/arc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/arc b/bin/arc index 4436fa89..d90715e7 100755 --- a/bin/arc +++ b/bin/arc @@ -7,9 +7,15 @@ # symlinks, etc. SOURCE="${BASH_SOURCE[0]}"; while [ -h "$SOURCE" ]; do - SOURCE="$(readlink "$SOURCE")"; + LINK="$(readlink "$SOURCE")"; + if [ "${LINK:0:1}" == "/" ]; then + # absolute symlink + SOURCE="$LINK" + else + # relative symlink + SOURCE="$(cd -P "$(dirname "$SOURCE")" && pwd)/$LINK" + fi done; DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)" exec $DIR/../scripts/arcanist.php "$@" -