Revision 9799
Added by Aaron Marcuse-Kubitza over 11 years ago
util.sh | ||
---|---|---|
120 | 120 |
# removes keyword-param-only vars from the environment |
121 | 121 |
{ unexport "$@"; } |
122 | 122 |
|
123 |
# usage: cmd=... foreach_arg |
|
124 |
function foreach_arg() |
|
125 |
{ |
|
126 |
echo_func; kw_params cmd; : "${cmd:?}"; local a |
|
127 |
for a in "$@"; do a="$(echo_run "$cmd" "$a")" || return; args+=("$a"); done |
|
128 |
echo_vars args |
|
129 |
} |
|
130 |
alias foreach_arg='"foreach_arg" "$@"; set -- "${args[@]}"; unset args' |
|
131 |
|
|
123 | 132 |
alias self='command "$FUNCNAME"' # usage: wrapper() { self ...; } |
124 | 133 |
alias self_sys='command -p "$FUNCNAME"' # usage: wrapper() { self_sys ...; } |
125 | 134 |
|
Also available in: Unified diff
lib/sh/util.sh: added foreach_arg()