瀏覽代碼

HADOOP-388. Fix scripts to work when run from a relative directory. Contributed by Owen.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@425666 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 年之前
父節點
當前提交
222029aeeb
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      bin/hadoop-config.sh

+ 4 - 1
bin/hadoop-config.sh

@@ -3,7 +3,10 @@
 # also should not be passed any arguments, since we need original $*
 
 # resolve links - $0 may be a softlink
-this="$0"
+bin=`dirname "$0"`
+script=`basename "$0"`
+bin=`cd "$bin"; pwd`
+this="$bin/$script"
 while [ -h "$this" ]; do
   ls=`ls -ld "$this"`
   link=`expr "$ls" : '.*-> \(.*\)$'`