Revision 13364
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
120 | 120 |
|
121 | 121 |
# usage: local prefix=..._; import_vars |
122 | 122 |
# when used inside another alias 2+ levels deep, *must* be run inside a function |
123 |
# vars already set will *not* be overwritten |
|
123 |
# idempotent: vars already set will *not* be overwritten
|
|
124 | 124 |
alias import_vars="$(cat <<'EOF' |
125 | 125 |
: "${prefix:?}" |
126 | 126 |
declare src_var dest_var |
trunk/lib/sh/db.sh | ||
---|---|---|
5 | 5 |
if self_not_included; then |
6 | 6 |
|
7 | 7 |
# using prefixed connection vars |
8 |
# idempotent |
|
8 | 9 |
alias ssh2local='declare prefix=ssh_; import_vars; unset prefix |
9 | 10 |
declare $(prefix=ssh_ get_prefix_vars); unset $(prefix=ssh_ get_prefix_vars)' |
10 | 11 |
alias use_local='declare prefix=local_; import_vars; unset prefix' |
Also available in: Unified diff
lib/sh/util.sh: import_vars: documented that it's idempotent