Created
February 18, 2018 19:49
-
-
Save mhingston/3ab043bc562ac78a04ad61e7de9223b6 to your computer and use it in GitHub Desktop.
Generate a random password using /dev/urandom
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 | |
if [[ $1 =~ ^[0-9]+$ ]] | |
then | |
cat /dev/urandom | tr -dc '[:graph:]' | head -c $1; echo | |
else | |
cat /dev/urandom | tr -dc '[:graph:]' | head -c 20; echo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment