Created
December 18, 2020 15:32
-
-
Save Rycieos/d187d856c674ae40fa68a32644c8db39 to your computer and use it in GitHub Desktop.
password
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
#!/usr/bin/env bash | |
# Create a randomly generated password | |
echo "\ | |
1. alpha | |
2. alpha + digit | |
3. alpha + digit + special | |
4. alpha + digit + space | |
5. alpha + digit + special + space | |
6. alpha + digit + limited | |
" | |
read -rp 'Type: ' type | |
case "${type}" in | |
1) | |
class='[:alpha:]' | |
;; | |
2) | |
class='[:alnum:]' | |
;; | |
3) | |
class='[:graph:]' | |
;; | |
4) | |
class='[:alnum:] ' | |
;; | |
5) | |
class='[:print:]' | |
;; | |
6) | |
class='[:alnum:].!@#$%^&*-' | |
;; | |
*) | |
exit 1 | |
;; | |
esac | |
read -rp 'Number of characters: ' chars | |
LC_ALL=C tr -dc "${class}" < /dev/urandom | head -c"${chars}" | |
printf '\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment