Created
May 3, 2018 08:54
-
-
Save wlkns/bb3afc5c2c2db6e51df859e55b24f403 to your computer and use it in GitHub Desktop.
Random password command line with password copied to clipboard (Usage: random_password <length default:12>) - Save to /usr/local/bin/random_password and don't forget to chmod +x the resulting file.
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
| #!/bin/sh | |
| LENGTH=${1:-12} | |
| RANDOM_STRING=`openssl rand -base64 ${LENGTH}` | |
| `echo "${RANDOM_STRING}" | tr -d '\n' | pbcopy` | |
| echo "\033[1;32mRandom Password: \033[0m" | |
| echo "" | |
| echo " ${RANDOM_STRING}" | |
| echo "" | |
| echo "\033[1;37mPassword copied to clipboard.\033[0m" |
wlkns
commented
May 3, 2018
Author

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment