Last active
May 7, 2019 02:29
-
-
Save o0-o/3e550bfaf08fb70ce1e50b133affab8e to your computer and use it in GitHub Desktop.
[Generate Password] Generate a long random password #Shell
This file contains hidden or 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
# password.sh | |
declare -r length=$(($(($RANDOM%17))+23)) 2>/dev/null && #23-39 | |
( #openssl | |
openssl rand -base64 "${length-32}" || | |
#os random | |
base64 < /dev/urandom | | |
fold --width="${length-32}" | | |
head -n 1 | |
) 2>/dev/null || | |
exit 1 #failure | |
exit 0 #success | |
#https://www.howtogeek.com/howto/30184/10-ways-to-generate-a-random-password-from-the-command-line/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment