Skip to content

Instantly share code, notes, and snippets.

@doertedev
Created September 17, 2015 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doertedev/cb03aef47aff9687d78a to your computer and use it in GitHub Desktop.
Save doertedev/cb03aef47aff9687d78a to your computer and use it in GitHub Desktop.
/dev/urand as a password generator
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Please provide a length (e.g. \`urandgen 40\`)!";
exit 1;
fi
# I rather use the whole list of characters and add/remove one by hand then to screw around with a-zA-Z9-9...
cat /dev/urandom | tr -dc 'qwertzuiopasdfghjklyxcvbnmQWERTZUIOPASDFGHJKLYXCVBNM1234567890,.-;:_!@§$%&/()=?`*+' | head -c $1
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment