Skip to content

Instantly share code, notes, and snippets.

@etigui
Last active October 14, 2020 12:35
Show Gist options
  • Save etigui/fd6d68363b87edb2aa928e18e127ec5c to your computer and use it in GitHub Desktop.
Save etigui/fd6d68363b87edb2aa928e18e127ec5c to your computer and use it in GitHub Desktop.
Bash - random string
#!/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