From 26eeba636a7cddfae45320c4d7d236dcd3ecdfd9 Mon Sep 17 00:00:00 2001 From: Chi Cao Minh Date: Wed, 19 Feb 2020 13:44:00 -0800 Subject: [PATCH] Make java version check work on all shells (#9376) * Make java version check work on all shells Previously, "perl verify-java" would fail on shells like zsh, which would cause the quickstart scripts (e.g., bin/start-micro-quickstart) to fail unless the DRUID_SKIP_JAVA_SKIP environment variable is set. * Support dash (ubuntu) --- examples/bin/java-util | 2 +- examples/bin/verify-java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bin/java-util b/examples/bin/java-util index 84c8bd25499..3732a8e55c0 100755 --- a/examples/bin/java-util +++ b/examples/bin/java-util @@ -33,7 +33,7 @@ get_java_bin_dir() { elif [ ! -z "$(command -v java)" ]; then # Strip /java from the location of where java is installed JAVA_ON_PATH="$(command -v java)" - echo -n "${JAVA_ON_PATH%/java}" + printf "${JAVA_ON_PATH%/java}" else printf "" fi diff --git a/examples/bin/verify-java b/examples/bin/verify-java index c8dcd19d8de..0a48d251808 100755 --- a/examples/bin/verify-java +++ b/examples/bin/verify-java @@ -52,7 +52,7 @@ if ($skip_var && $skip_var ne "0" && $skip_var ne "false" && $skip_var ne "f") { } my $cwd = dirname(__FILE__); -my $java_bin_dir = `source $cwd/java-util && get_java_bin_dir 2>&1`; +my $java_bin_dir = `. $cwd/java-util && get_java_bin_dir 2>&1`; # If we could not find java if ($java_bin_dir eq "") {