Skip to content

Instantly share code, notes, and snippets.

@syphoxy
Created September 22, 2013 02:31
Show Gist options
  • Save syphoxy/6656155 to your computer and use it in GitHub Desktop.
Save syphoxy/6656155 to your computer and use it in GitHub Desktop.
#!/bin/bash
while true
do
PASSWORD_LENGTH=20
password="$(head -n5 /dev/urandom | strings | tr -c '[:alnum:]' ' ' | tr -d '[:space:]' | cut -b1-$PASSWORD_LENGTH)"
[ "$(echo -n "$password" | wc -c)" -ne $PASSWORD_LENGTH ] || break
done
echo $password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment