summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2016-03-31 02:51:02 +0300
committerMichael Klishin <michael@clojurewerkz.org>2016-03-31 02:51:02 +0300
commit93dbc2ff09234740caedb4e9cd9610f79c7a4e9d (patch)
treeeb228d22f488c9392446a2a717e80983fe8396ca
parentc8eb1766195d790acf58bac1080039f843341e4f (diff)
downloadrabbitmq-server-git-93dbc2ff09234740caedb4e9cd9610f79c7a4e9d.tar.gz
Strip off trailing .conf/.config using dirname and basename
Otherwise if there is no dot in RABBITMQ_CONFIG_FILE, RABBITMQ_CONFIG_FILE_NOEX ends up being empty.
-rwxr-xr-xscripts/rabbitmq-server10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server
index 0a67e00415..7853fea2f4 100755
--- a/scripts/rabbitmq-server
+++ b/scripts/rabbitmq-server
@@ -95,7 +95,15 @@ fi
set -e
-RABBITMQ_CONFIG_FILE_NOEX="${RABBITMQ_CONFIG_FILE%.*}"
+strip_trailing_config_or_conf() {
+ local dir=$(dirname $1)
+ local filename_without_conf=$(basename $1 .conf)
+ local filename_without_config=$(basename $filename_without_conf .config)
+
+ echo "$dir/$filename_without_config"
+}
+
+RABBITMQ_CONFIG_FILE_NOEX=$(strip_trailing_config_or_conf $RABBITMQ_CONFIG_FILE)
if [ "${RABBITMQ_CONFIG_FILE_NOEX}.config" == "${RABBITMQ_CONFIG_FILE}" ]; then
if [ -f "${RABBITMQ_CONFIG_FILE}" ]; then