From afccc39b37103f5df580fb90f7c6578467bdfcf7 Mon Sep 17 00:00:00 2001 From: C-Duv Date: Sat, 11 Feb 2017 16:40:39 +0100 Subject: [PATCH] Fixes configuration loading Two bugs were introduced when adding configuration file support: * Passing the message as script parameter was not working when `-c` option was used (eg. `script -c cfg msg`) * `-c` configuration file was not loaded properly This commit fixes these 2 bugs. --- send-notification.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/send-notification.sh b/send-notification.sh index d4ef30c..c968a0e 100644 --- a/send-notification.sh +++ b/send-notification.sh @@ -39,6 +39,7 @@ while getopts "c:h" option; do h) usage_help ; exit 0 ;; esac done +shift $((OPTIND-1)) ## @@ -84,7 +85,7 @@ Le serveur de la maison" if [ -n "${CONFIG_FILE}" ]; then if [ -e "${CONFIG_FILE}" ]; then - . "./${CONFIG_FILE}" + . "${CONFIG_FILE}" else echo "ERROR: Configuration file \"${CONFIG_FILE}\" does not exists." >&2 exit 2 @@ -97,6 +98,7 @@ else fi fi + ## ## Vérifications des paramètres requis ##