lists.arthurdejong.org
RSS feed

svn2cl commit: r180 - svn2cl

[Date Prev][Date Next] [Thread Prev][Thread Next]

svn2cl commit: r180 - svn2cl



Author: arthur
Date: Sun Apr  9 14:40:12 2023
New Revision: 180
URL: http://arthurdejong.org/viewvc/svn2cl?revision=180&view=revision

Log:
Use readlink it if it available

Modified:
   svn2cl/svn2cl.sh

Modified: svn2cl/svn2cl.sh
==============================================================================
--- svn2cl/svn2cl.sh    Sun Apr  9 13:53:34 2023        (r179)
+++ svn2cl/svn2cl.sh    Sun Apr  9 14:40:12 2023        (r180)
@@ -270,14 +270,20 @@
 done
 
 # find the directory that this script resides in
-prog="$0"
-while [ -h "$prog" ]
-do
+if [ -x `which readlink` ]
+then
+  prog="$(readlink -f "$0")"
+  dir="$(dirname "$prog")"
+else
+  prog="$0"
+  while [ -h "$prog" ]
+  do
+    dir=`dirname "$prog"`
+    prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$dir/,"`
+  done
   dir=`dirname "$prog"`
-  prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$dir/,"`
-done
-dir=`dirname "$prog"`
-dir=`cd "$dir" && pwd`
+  dir=`cd "$dir" && pwd`
+fi
 XSL="$dir/svn2${OUTSTYLE}.xsl"
 
 # check if the authors file is formatted as a legacy