Author: vines
Date: Wed Jan 2 21:02:37 2013
New Revision: 1428040
URL: http://svn.apache.org/viewvc?rev=1428040&view=rev
Log:
ACCUMULO-432 - Adding readlink (with work around for BSDs lack of -f support...
stupid bsd)
Modified:
accumulo/trunk/bin/accumulo
Modified: accumulo/trunk/bin/accumulo
URL:
http://svn.apache.org/viewvc/accumulo/trunk/bin/accumulo?rev=1428040&r1=1428039&r2=1428040&view=diff
==============================================================================
--- accumulo/trunk/bin/accumulo (original)
+++ accumulo/trunk/bin/accumulo Wed Jan 2 21:02:37 2013
@@ -15,8 +15,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+_readlink ()
+{
+ result=`readlink -f $1 2>/dev/null`
+ if [ $? -eq 0 ];
+ then
+ echo $result
+ return 0
+ fi
+
+ oldPath=$1
+ if [ -n `echo $oldPath | egrep "^[.]"` ]; then
+ oldPath=`echo $1 | sed -e 's#[.]/##'`
+ fi
+ if [ -z `echo $oldPath | egrep '^/'` ]; then
+ oldPath="`pwd`/$oldPath"
+ fi
+ newPath=$oldPath
+ while [ "$newPath" ];
+ do
+ oldPath=$newPath
+ newPath=`readlink $newPath`
+ done
+
+ echo $oldPath
+ return 0
+}
-bin=`dirname "$0"`
+bin=`_readlink $0`
+bin=`dirname "$bin"`
bin=`cd "$bin"; pwd`
. "$bin"/config.sh