#!/bin/ksh
#
# Random 8 character password generator
#
# I hope you find this 100 times better than the 'tr' method!
#
# Phil Ehrens <phil@slug.org>
#
newpass() {
typeset junk
while [[ ${#junk} -lt 8 ]]
do
junk=$(/bin/dd if=/dev/urandom bs=1k count=1 2>/dev/null)
junk=${junk//[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]/}
done
print ${junk:0:8}
}
foo=$(newpass)
print $foo