Revision 8863
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/util.sh | ||
---|---|---|
92 | 92 |
# usage: local var=...; local_inv |
93 | 93 |
alias local_inv='local "no_$var=$(test -n "${!var}" || echo 1)"' |
94 | 94 |
|
95 |
# usage: local prefix=..._; import_vars |
|
96 |
alias import_vars="$(cat <<'EOF' |
|
97 |
: "${prefix:?}" |
|
98 |
local src_var dest_var |
|
99 |
for src_var in $(eval echo '${!'$prefix'*}'); do |
|
100 |
dest_var="${src_var#$prefix}" |
|
101 |
local "$dest_var=${!src_var}"; echo_vars "$dest_var" |
|
102 |
done |
|
103 |
EOF |
|
104 |
)" |
|
105 |
|
|
95 | 106 |
#### commands |
96 | 107 |
|
97 | 108 |
top_dir="$(dirname "$0")" # outermost script |
Also available in: Unified diff
lib/util.sh: added import_vars alias