improved handling of symlinks;
authorwenzelm
Tue, 26 Apr 2005 19:49:39 +0200
changeset 15843 d5bd4a18ce70
parent 15842 30a4267c6301
child 15844 6b1e5f703246
improved handling of symlinks;
bin/isabelle
bin/isabelle-interface
bin/isabelle-process
bin/isatool
--- a/bin/isabelle	Tue Apr 26 17:44:24 2005 +0200
+++ b/bin/isabelle	Tue Apr 26 19:49:39 2005 +0200
@@ -5,11 +5,12 @@
 #
 # Smart selection of isabelle-process versus isabelle-interface.
 
-THIS="$0"
-while [ -L "$THIS" ]; do
-    THIS="$(dirname "$THIS")/$(LC_ALL=C ls -l "$THIS" | sed 's/.* -> //')"
-done
-THIS="$(cd "$(dirname "$THIS")"; pwd)"
+if [ -L "$0" ]; then
+  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
+  exec $(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET") "$@"
+fi
+
+THIS=$(cd "$(dirname "$0")"; pwd)
 NAME="$(basename "$0")"
 
 case "$NAME" in
--- a/bin/isabelle-interface	Tue Apr 26 17:44:24 2005 +0200
+++ b/bin/isabelle-interface	Tue Apr 26 19:49:39 2005 +0200
@@ -5,16 +5,17 @@
 #
 # Isabelle interface startup script.
 
+if [ -L "$0" ]; then
+  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
+  exec $(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET") "$@"
+fi
+
 
 ## settings
 
 PRG="$(basename "$0")"
 
-THIS="$0"
-while [ -L "$THIS" ]; do
-    THIS="$(dirname "$THIS")/$(LC_ALL=C ls -l "$THIS" | sed 's/.* -> //')"
-done
-ISABELLE_HOME="$(cd "$(dirname "$THIS")/.."; pwd)"
+ISABELLE_HOME="$(dirname "$0")/.."
 . "$ISABELLE_HOME/lib/scripts/getsettings" || \
   { echo "$PRG probably not called from its original place!"; exit 2; }
 
--- a/bin/isabelle-process	Tue Apr 26 17:44:24 2005 +0200
+++ b/bin/isabelle-process	Tue Apr 26 19:49:39 2005 +0200
@@ -5,16 +5,17 @@
 #
 # Isabelle process startup script.
 
+if [ -L "$0" ]; then
+  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
+  exec $(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET") "$@"
+fi
+
 
 ## settings
 
 PRG="$(basename "$0")"
 
-THIS="$0"
-while [ -L "$THIS" ]; do
-    THIS="$(dirname "$THIS")/$(LC_ALL=C ls -l "$THIS" | sed 's/.* -> //')"
-done
-ISABELLE_HOME="$(cd "$(dirname "$THIS")/.."; pwd)"
+ISABELLE_HOME="$(dirname "$0")/.."
 . "$ISABELLE_HOME/lib/scripts/getsettings" || \
   { echo "$PRG probably not called from its original place!"; exit 2; }
 
--- a/bin/isatool	Tue Apr 26 17:44:24 2005 +0200
+++ b/bin/isatool	Tue Apr 26 19:49:39 2005 +0200
@@ -6,6 +6,11 @@
 # Isabelle tool starter -- provides settings environment
 # and keeps your PATH name space clean.
 
+if [ -L "$0" ]; then
+  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
+  exec $(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET") "$@"
+fi
+
 
 ## settings