rice/password-gen.sh
2022-05-01 19:38:12 -07:00

25 lines
340 B
Bash
Executable File

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