Revision 13320
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
200 | 200 |
{ local arg; for arg in "$@"; do printf '%q ' "$arg"; done; } |
201 | 201 |
|
202 | 202 |
# usage: split delim str; use ${parts[@]} |
203 |
function split() { local IFS="$1"; parts=($2); echo_vars parts; }
|
|
203 |
function split() { split__with_IFS "$@"; echo_vars parts; }
|
|
204 | 204 |
# no echo_func because used by log++ |
205 |
split__with_IFS() { local IFS="$1"; parts=($2); } # limit effects of IFS |
|
205 | 206 |
alias split='declare parts; "split"' |
206 | 207 |
|
207 | 208 |
join() { local IFS="$delim"; echo "$*"; } # usage: delim=char join elems... |
Also available in: Unified diff
bugfix: lib/sh/util.sh: split(): need to limit the effects of IFS to just the splitting, so it doesn't cause strange errors in other functions