Project

General

Profile

« Previous | Next » 

Revision 9799

lib/sh/util.sh: added foreach_arg()

View differences:

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