vendredi 19 juin 2015

Random password generate in shell script with one special character

I have following code

</dev/urandom tr -dc 'A-Za-z0-9@#$%&_+=' | head -c 16

which is randomly generating password perfectly.

I want two changes:

  1. It should only contain 1 special symbols that i have listed there
  2. It should choose random length of the password

I tried with length = $(($RANDOM%8+9))

then putting length at

</dev/urandom tr -dc 'A-Za-z0-9@#$%&_+=' | head -c$length

but no positive result.




Aucun commentaire:

Enregistrer un commentaire