I want to create a custom variable or command that can be called on like $RANDOM, but for strings. I have a script that creates a random string, using /dev/urandom . The script produces a randomly generated string each time the script is run.
#!/bin/bash
rando=$(head -100 /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 15 | head -1)
echo $rando
If I create an alias or environmental variable that calls on the script, it will produce only one variation of a random string until a new bash sessions is created. How can I make it so it will create a new variation of the random string in the same bash session?
Aucun commentaire:
Enregistrer un commentaire