Last active
February 4, 2021 20:53
-
-
Save davenicoll/da7fb2546bfdb39cde9c2623f6237328 to your computer and use it in GitHub Desktop.
Create a random password in bash
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
random_password() | |
{ | |
LENGTH=32; if [[ -n "$1" ]]; then LENGTH=$1; fi | |
</dev/urandom tr -dc '0-9-a-z-A-Z@#()-=_+[]{},.' | head -c"$LENGTH"; echo "" | |
} | |
PASSWORD=$(random_password 20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment