This bash command generates a short hash that I'd like to use to name a directory created with mkdir
:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
Which (I think):
- Creates a random-ish number
- Limits the character set with tr (translation)
- Folds/wraps each line of output at 32 characters
- Limits output to one line starting at the start with head
I can simply copy the output of this command and paste it into a mkdir
command, but how would it be done in a single command?
I tried adding | mkdir
and | mkdir -p
to then end, thinking I could pipe the output to mkdir
.
Aucun commentaire:
Enregistrer un commentaire