For Mac OSX (at least Yosemite), I had to do the following to make it work (and expand what it could do):
genpass() { local p=$1 [ "$p" == "" ] && p=16 LCCTYPE=C tr -dc A-Za-z0-9!\@#\$\%^&*()-+= < /dev/urandom | head -c ${p} | xargs }
For Mac OSX (at least Yosemite), I had to do the following to make it work (and expand what it could do):
genpass() {
local p=$1
[ "$p" == "" ] && p=16
LCCTYPE=C tr -dc A-Za-z0-9!\@#\$\%^&*()-+= < /dev/urandom | head -c ${p} | xargs
}