Commit b7612650 authored by Mikhail Tergoev's avatar Mikhail Tergoev

Merge branch 'Boria138-show-var' into devel

parents bbcd2453 0ed51666
...@@ -551,18 +551,37 @@ ${translations[Usage examples:]} ...@@ -551,18 +551,37 @@ ${translations[Usage examples:]}
pw_init_db pw_init_db
fi fi
grep -E '^export ' "$ppdb_path" \ declare -A all_vars
| sed '/^[[:space:]]*$/d' \ while IFS='=' read -r key val; do
| while IFS= read -r line; do key="${key#export }"
line="${line#export }" val="${val#\"}"
if [[ "$line" =~ ^([^=]+)=\"([^\"]*)\"[[:space:]]*#.*$ ]]; then val="${val%\"}"
echo "${BASH_REMATCH[1]}=\"${BASH_REMATCH[2]}\"" all_vars["$key"]="$val"
elif [[ "$line" =~ ^([^=]+)=([^#[:space:]]+)[[:space:]]*#.*$ ]]; then done < <(grep -E '^export ' "$ppdb_path" | sed '/^[[:space:]]*$/d')
echo "${BASH_REMATCH[1]}=${BASH_REMATCH[2]}"
else check_user_conf
echo "$line" if [[ -f "$USER_CONF" ]]; then
while IFS='=' read -r key val; do
key="${key#export }"
val="${val#\"}"
val="${val%\"}"
all_vars["$key"]="$val"
done < <(grep -E '^export ' "$USER_CONF" 2>/dev/null | sed '/^[[:space:]]*$/d')
fi
while IFS='=' read -r key val; do
key="${key#export }"
val="${val#\"}"
val="${val%\"}"
if [[ -z "${all_vars[$key]+x}" ]]; then
all_vars["$key"]="$val"
fi fi
done < <(grep -E '^export ' "$PORT_SCRIPTS_PATH/var" | sed '/^[[:space:]]*$/d')
for key in "${!all_vars[@]}"; do
echo "${key}=\"${all_vars[$key]}\""
done done
exit 0 exit 0
;; ;;
--backup-prefix) --backup-prefix)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment