Revision 9711
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
181 | 181 |
|
182 | 182 |
starts_with() { test "${2#$1}" != "$2"; } # usage: starts_with pattern str |
183 | 183 |
|
184 |
match_prefix() # usage: match_prefix pattern str |
|
185 |
{ if starts_with "$1" "$2"; then echo "${2%${2#$1}}"; fi } |
|
186 |
|
|
184 | 187 |
repeat() # usage: str=... n=... repeat |
185 | 188 |
{ |
186 | 189 |
: "${str?}" "${n:?}"; local result= n="$n" # n will be modified in function |
Also available in: Unified diff
lib/sh/util.sh: added match_prefix()