Revision 13175
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
332 | 332 |
|
333 | 333 |
echo1() { echo "$1"; } # usage: echo1 values... |
334 | 334 |
|
335 |
esc_args() # usage: array=($(log++; prep_env... (eg. cd); esc_args args...))
|
|
335 |
esc() # usage: array=($(log++; prep_env... (eg. cd); esc args...))
|
|
336 | 336 |
{ local arg; for arg in "$@"; do printf '%q ' "$arg"; done; } |
337 | 337 |
|
338 | 338 |
# usage: split delim str; use ${parts[@]} |
... | ... | |
408 | 408 |
strip/() { echo "${1%/}"; } # strips trailing /s |
409 | 409 |
|
410 | 410 |
wildcard/() # usage: array=($(log++; [cd ...;] wildcard/ unquoted_pattern...)) |
411 |
{ cmd=strip/ foreach_arg; esc_args "$@"; }
|
|
411 |
{ cmd=strip/ foreach_arg; esc "$@"; } |
|
412 | 412 |
|
413 | 413 |
wildcard.() # usage: array=($(log++; [cd ...;] wildcard. unquoted_pattern...)) |
414 | 414 |
# currently only removes . .. at beginning of list |
... | ... | |
420 | 420 |
shift |
421 | 421 |
if contains "$1" "${to_rm[@]}"; then shift; fi |
422 | 422 |
fi |
423 |
esc_args "$@"
|
|
423 |
esc "$@" |
|
424 | 424 |
} |
425 | 425 |
|
426 | 426 |
#### streams |
Also available in: Unified diff
lib/sh/util.sh: esc_args(): renamed to just esc() because this can also be used on a single value