Skip to content

Instantly share code, notes, and snippets.

@jemyzhang
Created July 8, 2016 09:03
Show Gist options
  • Save jemyzhang/04d5592b9e4bf3ba11e3b9eaf34ff0ca to your computer and use it in GitHub Desktop.
Save jemyzhang/04d5592b9e4bf3ba11e3b9eaf34ff0ca to your computer and use it in GitHub Desktop.
generate random string in shell script
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment