\Hello,
I've been searching for a day but cannot find a way to specify concrete password requirements when generating one with Bash:
-at least 12 char length:
-at least 4 different letters:
-at least 3 digits:
-at least 3 special chars -_+=#^*
I use the urandom: tr -dc A-Za-z0-9_ < /dev/urandom | head -c 16 | xargs
which generates, in this case, 16 char string with letters, numbers and underscore. But I cannot specify the critera above.
For example this would fulfill criteria:
echo $(tr -dc A-Za-z < /dev/urandom | head -c 16)abcd123+-=
First criterium is easy and you already achieved that, others are fulfilled by fixed suffix appended to end.
You can make it bit better by random permutation of the result:
echo $(echo $(tr -dc A-Za-z < /dev/urandom | head -c 16)abcd123+-= | fold -w 1 | shuf | tr -d "\n")
(I helped myself with this answer)