On Thu, Feb 21, 2002 at 06:02:52PM -0600, John Hasler wrote: > Steve writes: > > ...I can't think of a sane way to do this in plain POSIX sh. > until [ `expr "$PASSWORD" : ".*"` -ge 8 ] > do > PASSWORD=`head -c 100 /dev/urandom | tr -dc '[:alnum:]' | tail -c 8` > done Which actually does something quite different by discarding bytes whose values don't fall in the proper range (bad if using a PRNG because it can expose non-random patterns, bad if using a true RNG because it wastes entropy), but it'll do in a pinch. :) Steve Langasek postmodern programmer
Attachment:
pgpbeQNUtvh75.pgp
Description: PGP signature