Looking at this: https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-... Another simpler candidate is: `printf '%*s' $total | tr ' ' '-'` There is a pipe, ok, but still much fewer calls to external commands. :) printf is already used all around, and tr seems available on OpenBSD. Runs even in (t)csh! (this is of no use since the rest of the script won't)