generate a random password where the first character is a letter closed

One simple idea would be to randomly generate a single-character string (only letters) and then append the results of a second randomly genarated multi-character string, eg:

$ pfx=$(< /dev/urandom tr -dc 'a-zA-Z' | head -c1)
$ echo "${pfx}"
$ sfx=$(< /dev/urandom tr -dc 'a-zA-Z0-9#_$' | head -c $((7+$RANDOM%13)))
$ echo "${sfx}"
$ newpwd="${pfx}${sfx}"
$ echo "${newpwd}"

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top