From 6ba117dc9d3465a79118bb58d579a40208b2f084 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Fri, 19 Jan 2018 18:46:53 +1000 Subject: [PATCH] Source cfg in printconfig if readable --- tools/arkmanager | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/arkmanager b/tools/arkmanager index 2ff8ede..d800017 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -2975,13 +2975,15 @@ doPrintConfig(){ vals["$v"]="${!v}" done for cfgfile in "$configfile" "${HOME}/${arkstUserCfgFile}" "${arkstGlobalCfgFile}"; do - while read v; do - val="$(source "$cfgfile"; echo "${!v}")" - if [[ "$val" = "${vals[$v]}" && -z "${vars[$v]}" ]]; then - vars["$v"]="$cfgfile" - echo "${cfgfile} => ${v}" - fi - done < <(sed -n 's/^[[:space:]]*\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p' <"$cfgfile") + if [ -r "$cfgfile" ]; then + while read v; do + val="$(source "$cfgfile"; echo "${!v}")" + if [[ "$val" = "${vals[$v]}" && -z "${vars[$v]}" ]]; then + vars["$v"]="$cfgfile" + echo "${cfgfile} => ${v}" + fi + done < <(sed -n 's/^[[:space:]]*\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p' <"$cfgfile") + fi done }