Use string of uc characters, since it's faster.
Move bash-4 code out of the loop.