Project

General

Profile

« Previous | Next » 

Revision 9304

lib/sh/util.sh: repeat(): for simplicity and speed, just append to a local string var (and echo the result at the end) instead of using printf

View differences:

util.sh
122 122

  
123 123
repeat() # usage: str=... n=... repeat
124 124
{
125
	: "${str?}" "${n:?}"; local n="$n" # will be modified in function
126
	for (( ; n > 0; n-- )); do printf '%s' "$str"; done
125
	: "${str?}" "${n:?}"; local result= n="$n" # n will be modified in function
126
	for (( ; n > 0; n-- )); do result="$result$str"; done
127
	echo "$result"
127 128
}
128 129

  
129 130
sed_ere_flag="$(test "$(uname)" = Darwin && echo E || echo r)"

Also available in: Unified diff