rice/password-gen.sh
2020-03-12 14:34:22 -07:00

24 lines
326 B
Bash
Executable File

#!/bin/sh
alnum() {
cat /dev/urandom | tr -dc [:alnum:] | fold -w 32 | head -1
}
alnum_spec() {
cat /dev/urandom | tr -dc [:alnum:]'!@#$%^&*()-_=+' | fold -w 32 | head -1
}
_help() {
echo 'Flags:
a - alphanumeric set
s - alphanumeric + special characters'
}
case $1 in
a) alnum;;
s) alnum_spec;;
*) _help;;
esac