Skip to content

Instantly share code, notes, and snippets.

@weivall
Created April 20, 2012 21:21
Show Gist options
  • Save weivall/2431975 to your computer and use it in GitHub Desktop.
Save weivall/2431975 to your computer and use it in GitHub Desktop.
genpasswd()
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment