diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-05-27 12:30:53 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-05-27 12:34:24 +0200 |
commit | 1a90add12ed8ab5b8b2117fd4f079749865211e4 (patch) | |
tree | 52fcb388e918473adf7d9bf29d11e063ea1f4005 | |
parent | f2c8685cc00d1d22e61368fbb8283b379cc2e3df (diff) |
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
-rwxr-xr-x | sfeed_update | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sfeed_update b/sfeed_update index a7e94d5..ba9e242 100755 --- 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 |