diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2016-03-31 02:51:02 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2016-04-05 21:32:12 +0300 |
| commit | e3b856330562951fff07767ba82ccd03b13a19a4 (patch) | |
| tree | 2b14d4878efc7df0622deb8e48cefd29bede5c2a /scripts | |
| parent | db4d5426b65763dd05fdb02d49336dd14d4c7cbc (diff) | |
| download | rabbitmq-server-git-e3b856330562951fff07767ba82ccd03b13a19a4.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.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/rabbitmq-server | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server index 0638dd9af3..65bca88844 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 |
