commit 1a90add12ed8ab5b8b2117fd4f079749865211e4
parent f2c8685cc00d1d22e61368fbb8283b379cc2e3df
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 27 May 2021 12:30:53 +0200
sfeed_update: fix message when the configuration file does not exist
When sfeed_update was called without using a parameter and it used the default
and this path did not exist it would incorrectly print:
Configuration file "" does not exist or is not readable.
See sfeedrc.example for an example.
Make the error message a bit shorter too.
This was a partial regression of commit df74ba274c4ea5d9b7388c33500ba601ed0c991d
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sfeed_update b/sfeed_update
@@ -14,18 +14,20 @@ maxjobs=8
loadconfig() {
# allow to specify config via argv[1].
if [ "$1" != "" ]; then
- # get absolute path of config file.
- config=$(readlink -f "$1" 2>/dev/null)
+ # get absolute path of config file required for including.
+ config="$1"
+ path=$(readlink -f "${config}" 2>/dev/null)
else
# default config location.
config="$HOME/.sfeed/sfeedrc"
+ path="${config}"
fi
# config is loaded here to be able to override $sfeedpath or functions.
- if [ -r "${config}" ]; then
- . "${config}"
+ if [ -r "${path}" ]; then
+ . "${path}"
else
- echo "Configuration file \"$1\" does not exist or is not readable." >&2
+ echo "Configuration file \"${config}\" cannot be read." >&2
echo "See sfeedrc.example for an example." >&2
exit 1
fi