Creating string of repeated characters in shell script [duplicate]

You can get as many NULL bytes as you want from /dev/zero. You can then turn these into other characters. The following prints 16 lowercase a’s

head -c 16 < /dev/zero | tr '\0' '\141'

Leave a Comment