hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zs...@apache.org
Subject svn commit: r832119 - /hadoop/hive/branches/branch-0.4/bin/ext/cli.sh
Date Mon, 02 Nov 2009 21:52:19 GMT
Author: zshao
Date: Mon Nov  2 21:52:19 2009
New Revision: 832119

URL: http://svn.apache.org/viewvc?rev=832119&view=rev
Log:
HIVE-902. Fix cli.sh to work with hadoop versions less than 20. (Carl Steinbach via zshao)

Modified:
    hadoop/hive/branches/branch-0.4/bin/ext/cli.sh

Modified: hadoop/hive/branches/branch-0.4/bin/ext/cli.sh
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.4/bin/ext/cli.sh?rev=832119&r1=832118&r2=832119&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.4/bin/ext/cli.sh (original)
+++ hadoop/hive/branches/branch-0.4/bin/ext/cli.sh Mon Nov  2 21:52:19 2009
@@ -16,10 +16,14 @@
 
   version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
 
-  if [[ $version =~ ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+).*$ ]]; then
+  # Save the regex to a var to workaround quoting incompatabilities
+  # between Bash 3.1 and 3.2
+  version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
+
+  if [[ "$version" =~ $version_re ]]; then
       major_ver=${BASH_REMATCH[1]}
       minor_ver=${BASH_REMATCH[2]}
-      patch_ver=${BASH_REMATCH[3]}
+      patch_ver=${BASH_REMATCH[4]}
   else
       echo "Unable to determine Hadoop version information."
       echo "'hadoop version' returned:"
@@ -27,7 +31,7 @@
       exit 6
   fi
 
-  if [ $minor_ver -le 20 ]; then
+  if [ $minor_ver -lt 20 ]; then
       exec $HADOOP jar $AUX_JARS_CMD_LINE ${HIVE_LIB}/hive_cli.jar $CLASS $HIVE_OPTS "$@"
   else
       # hadoop 20 or newer - skip the aux_jars option. picked up from hiveconf



Mime
View raw message