Created
September 10, 2012 03:55
-
-
Save lavoiesl/3688791 to your computer and use it in GitHub Desktop.
Generates a random password using only non-ambiguous alphanumeric characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generates a random password using only non-ambiguous alphanumeric characters | |
# Usage: genpasswd.sh [length] | |
length=16 | |
if [[ -n "$1" ]]; then | |
length="$1" | |
fi | |
head -c $(( 2 * $length)) /dev/urandom | base64 | sed -E 's/[^23456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]//g' | head -c $length | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment