diff options
-rw-r--r-- | src/cpt-lib.in | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 1280765..b01790d 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -132,20 +132,16 @@ trap_set() { esac } -sepchar() ( +sepchar() { # Seperate every character on the given string without resorting to external # processes. [ "$1" ] || return 0; str=$1; set -- while [ "$str" ]; do - str_tmp=$str - for i in $(_seq $(( ${#str} - 1 ))); do - str_tmp=${str_tmp%?} - done - set -- "$@" "$str_tmp" - str=${str#$str_tmp} + set -- "$@" "${str%${str#?}}" + str=${str#?} done printf '%s\n' "$@" -) +} _re() { # Check that the string supplied in $2 conforms to the regular expression |