From 06f92ea39d23dfa3109b7fcccab12f0a6e5e6ef3 Mon Sep 17 00:00:00 2001 From: Janos Gyerik Date: Fri, 7 Jul 2017 23:37:39 +0200 Subject: Simplify and modernize real_path --- src/main/assembly/bin/sonar-scanner | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/assembly/bin/sonar-scanner b/src/main/assembly/bin/sonar-scanner index d6ffd57..dc9d263 100755 --- a/src/main/assembly/bin/sonar-scanner +++ b/src/main/assembly/bin/sonar-scanner @@ -14,22 +14,15 @@ real_path () { while true; do cd "$(dirname "$target")" target=$(basename "$target") - link=$(readlink "$target") - test "$link" || break - target=$link + test -L "$target" || break + target=$(readlink "$target") done echo "$(pwd -P)/$target" ) } -script_path="$0" - -if [ -h "$script_path" ] ; then - # resolve recursively symlinks - script_path=$(real_path "$script_path") -fi - +script_path=$(real_path "$0") sonar_scanner_home=$(dirname "$script_path")/.. # make it fully qualified -- cgit v1.2.3