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 df74ba274c
This commit is contained in:
Hiltjo Posthuma 2021-05-27 12:30:53 +02:00
parent f2c8685cc0
commit 1a90add12e
1 changed files with 7 additions and 5 deletions

View File

@ -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