Last active
October 14, 2020 12:35
-
-
Save etigui/fd6d68363b87edb2aa928e18e127ec5c to your computer and use it in GitHub Desktop.
Bash - random string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function rand() { | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1 | |
} | |
echo $(rand 20) | |
## OUTPUT | |
# w4QS0zoS9yUUAEc6dlMJ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment