Source cfg in printconfig if readable

This commit is contained in:
Ben Peddell 2018-01-19 18:46:53 +10:00
parent 8f7ed3cd05
commit 6ba117dc9d

View File

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