diff options
-rwxr-xr-x | sfeed_opml_export | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sfeed_opml_export b/sfeed_opml_export index d15cbba..835a576 100755 --- a/sfeed_opml_export +++ b/sfeed_opml_export @@ -4,20 +4,22 @@ # loadconfig(configfile) loadconfig() { # allow to specify config via argv[1]. - if [ ! x"$1" = x"" ]; then - # get absolute path of config file. - config=$(readlink -f "$1") + if [ "$1" != "" ]; then + # 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 - # load config: config is loaded here to be able to override above variables - # (sfeedpath, sfeedfile, etc). - if [ -r "$config" ]; then - . "$config" + # config is loaded here to be able to override $sfeedpath or functions. + if [ -r "${path}" ]; then + . "${path}" else - echo "Configuration file \"$config\" 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 } |