mercredi 16 mars 2022

Prevent final character from being a number

In bash, I run the following to get a random string:

echo $(LC_CTYPE=C tr -dc 'a-z0-9' </dev/urandom | fold -w 5 | head -n1)

However, I need to make sure the last character is not a number.

What can I add to the command to do this, keeping it as a one-liner?

(I'd like it to be the same length, but if I have to trim it to 4 chars, so be it)




Aucun commentaire:

Enregistrer un commentaire