My goal is to have something like this in bash:
str=random_string(n scharacters)
I have managed to do the following:
chars=abcdefghijklmnopqrstuvwxyz
for (( i=1; i<=n; i++ ))
do
str="${chars:RANDOM%${#chars}:1}"
done
The problem is that str
also contains new lines.
Do you have any ideas?
Aucun commentaire:
Enregistrer un commentaire