Created
February 24, 2012 21:15
-
-
Save melissaboiko/1903791 to your computer and use it in GitHub Desktop.
kind of dumb script to generate xkcd-style password
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
#!/bin/bash | |
# http://xkcd.com/936/ | |
# http://namakajiri.net/misc/substantivos_pt.ascii | |
# TODO: getopt | |
# dict="/usr/share/dict/words" | |
# dict="/usr/share/dict/brazilian.utf8" | |
dict=/usr/local/share/dict/substantivos_pt.ascii | |
set -e | |
[ -r $dict ] | |
which shuf >/dev/null | |
function choose_word() | |
{ | |
while true; do | |
choice=$(shuf -n 1 $dict) | |
if ! echo $choice | grep -q "^[A-Z]"; then | |
break | |
fi | |
done | |
echo $choice | |
} | |
echo "$(choose_word)$(choose_word)$(choose_word)$(choose_word)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment