Revision 14682
Added by Aaron Marcuse-Kubitza about 10 years ago
util.sh | ||
---|---|---|
768 | 768 |
{ |
769 | 769 |
log_local; log++ # same log_level as echo_func |
770 | 770 |
if can_log; then |
771 |
local set_exprs= |
|
771 |
local set_exprs= shared_flags=
|
|
772 | 772 |
local var; for var in "${@%%=*}"; do |
773 | 773 |
if ! isset "$var"; then declare "$var"='<unset>'; fi |
774 |
decl="$(declare -p "$var")" |
|
775 |
set_exprs="$set_exprs${decl#declare } " |
|
774 |
|
|
775 |
# merge repeated flags |
|
776 |
local decl="$(declare -p "$var")"; decl="${decl#declare }" |
|
777 |
local flags="${decl%% *}" def="${decl#* }" |
|
778 |
if test ! "$shared_flags"; then shared_flags="$flags"; fi |
|
779 |
if test "$flags" != "$shared_flags"; then |
|
780 |
set_exprs="$set_exprs$flags " |
|
781 |
fi |
|
782 |
set_exprs="$set_exprs$def " |
|
776 | 783 |
done |
777 | 784 |
# put all vars on same line so they don't clutter up the logging output |
778 |
log "declare $set_exprs" |
|
785 |
log "declare $shared_flags $set_exprs"
|
|
779 | 786 |
fi |
780 | 787 |
} |
781 | 788 |
|
Also available in: Unified diff
lib/sh/util.sh: echo_vars(): merge repeated flags so there aren't flags in between the vars (which is also not valid declare syntax)