Revision 11784
Added by Aaron Marcuse-Kubitza almost 11 years ago
lib/sh/util.sh | ||
---|---|---|
87 | 87 |
declare src_var dest_var |
88 | 88 |
for src_var in $(get_prefix_vars); do |
89 | 89 |
dest_var="${src_var#$prefix}" |
90 |
declare "$dest_var=${!src_var}"; echo_vars "$dest_var"
|
|
90 |
declare "$dest_var=${!dest_var-${!src_var}}"; echo_vars "$dest_var"
|
|
91 | 91 |
done |
92 | 92 |
EOF |
93 | 93 |
)" |
lib/sh/db.sh | ||
---|---|---|
8 | 8 |
declare $(prefix=ssh_ get_prefix_vars); unset $(prefix=ssh_ get_prefix_vars)' |
9 | 9 |
alias use_local='declare prefix=local_; import_vars; unset prefix' |
10 | 10 |
alias use_remote='declare prefix=remote_; import_vars; unset prefix' |
11 |
alias use_local_remote='{ use_local; use_remote; }'
|
|
11 |
alias use_local_remote='{ use_remote; use_local; }'
|
|
12 | 12 |
# *must* be run inside a function |
13 | 13 |
alias use_root='declare prefix=root_; import_vars; unset prefix' |
14 | 14 |
|
Also available in: Unified diff
lib/sh/util.sh: import_vars: don't overwrite vars that are already defined, to allow the caller to specify their own values for the vars to create. this requires callers that rely on the overwriting functionality to reverse the order in which they run use_* commands, so that the higher-precedence use_* is applied first and the other one as the default values for the first.