I wrote this Q+D script to demonstrate how much (how little) text was a
kilobyte (my friend and I were talking about our first computers). It can
be adjusted for any amount. It takes no arguments, all adjustments are done
by editing the source. Spaces don't count toward the character total.
# end configurable options
randmax=32768 # this has no significance to bash
spacecode=32 # decimal ASCII code for a space
spacelimit=$(( randmax - randmax / ( wordlength + 1 ) )) # if RANDOM > this,
print a space
while [ $counter -lt $characters ] ; do
thisrandom=$RANDOM # RANDOM = bash PRNG
if [ $thisrandom -gt $spacelimit ] ; then
charactercode=$(( 97 + thisrandom % 26 )) # 97=ASCII code for "a"
counter=$(( counter + 1 ))
echo $charactercode P
done | dc | fold -w 80 -s