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.
This commit is contained in:
C-Duv 2017-02-11 16:40:39 +01:00
parent 3e12046b97
commit afccc39b37

View File

@ -39,6 +39,7 @@ while getopts "c:h" option; do
h) usage_help ; exit 0 ;; h) usage_help ; exit 0 ;;
esac esac
done done
shift $((OPTIND-1))
## ##
@ -84,7 +85,7 @@ Le serveur de la maison"
if [ -n "${CONFIG_FILE}" ]; then if [ -n "${CONFIG_FILE}" ]; then
if [ -e "${CONFIG_FILE}" ]; then if [ -e "${CONFIG_FILE}" ]; then
. "./${CONFIG_FILE}" . "${CONFIG_FILE}"
else else
echo "ERROR: Configuration file \"${CONFIG_FILE}\" does not exists." >&2 echo "ERROR: Configuration file \"${CONFIG_FILE}\" does not exists." >&2
exit 2 exit 2
@ -97,6 +98,7 @@ else
fi fi
fi fi
## ##
## Vérifications des paramètres requis ## Vérifications des paramètres requis
## ##