From 5a726240a2e3fc25d7d324ff483567ec4b1b06ee Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Mon, 23 Mar 2009 17:52:47 +0000
Subject: [PATCH] Fix for issue #3626 (Occurrences of grep, cat,... commands should be replaced with sh built-in commands) Replace occurrences of 'cat' and 'grep' by shell builtin command.

---
 opends/resource/bin/_script-util.sh |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/opends/resource/bin/_script-util.sh b/opends/resource/bin/_script-util.sh
index b7bb925..b10b277 100644
--- a/opends/resource/bin/_script-util.sh
+++ b/opends/resource/bin/_script-util.sh
@@ -205,7 +205,7 @@
           exit 0
 	fi
       fi
-      INSTANCE_ROOT=`cat /etc/opends/instance.loc`
+      read INSTANCE_ROOT <  /etc/opends/instance.loc
     else
       if [ "${SCRIPT_NAME}" != "configure" ]
       then
@@ -220,12 +220,17 @@
   else
     if [ -f ${INSTALL_ROOT}/instance.loc ]
     then
-      if cat ${INSTALL_ROOT}/instance.loc | grep '^/' > /dev/null
-      then
-         INSTANCE_ROOT=`cat ${INSTALL_ROOT}/instance.loc`
-      else
-         INSTANCE_ROOT=${INSTALL_ROOT}/`cat ${INSTALL_ROOT}/instance.loc`
-      fi
+      read location < ${INSTALL_ROOT}/instance.loc
+      case `echo ${location}` in
+           /*)
+              INSTANCE_ROOT=${location}
+              break
+              ;;
+           *)
+              INSTANCE_ROOT=${INSTALL_ROOT}/${location}
+              break
+              ;;
+      esac
     else
          INSTANCE_ROOT=${INSTALL_ROOT}
     fi

--
Gitblit v1.10.0