I am trying to build a random character generator in a bash script on osx 10.8.5 . The goal is to generate random character strings for a script generating salts for the wor
I see two problems in your script.
I'm pretty sure
take=$(($RANDOM % 88));
should be
take=$(($RANDOM % 87));
Otherwise, it appears you're going past the end of your input stream.
The other problem is this char: \§
Bash is seeing that as two characters (wide char?). I'd delete it from your possibilities.
Of course, that would mean the above line would be:
take=$(($RANDOM % 86));
Doing those two things, in fact, works for me.
Edited:
@that other guy has a better answer. Adding the space rather than reducing the modulo will ensure that you get every character