Created
January 2, 2016 16:52
-
-
Save brianonn/cf7bb2e237fc37df8f04 to your computer and use it in GitHub Desktop.
SH: function for making random passwords
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
## put this into your ~/.bashrc file and make random passwords as needed. | |
## | |
## usage: | |
## mkpw <length> | |
## | |
## ex: for for i in $(seq 5);do mkpw 10 ; done | |
## Rw3QPaeUM2 | |
## qPgQnx5K38 | |
## wZnOZjQsdN | |
## H0tcr1tVrQ | |
## w3xnyY00lp | |
mkpw() | |
{ | |
[ $# -eq 0 ] && len=16 || len="$1" | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w "$len" | head -1 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Todo: I could enhance this with some options:
-l length - make passwords of length length
-n count - create count passwords