Skip to content

Instantly share code, notes, and snippets.

@nexus166
Created June 27, 2019 12:58
Show Gist options
  • Select an option

  • Save nexus166/dd7ac7a44c6e2efa57122a19650fce73 to your computer and use it in GitHub Desktop.

Select an option

Save nexus166/dd7ac7a44c6e2efa57122a19650fce73 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e +vx
_WORD=$(shuf -n1 "${WORDLIST:-/usr/share/dict/words}" 2>/dev/null | tr -cd "[[:alpha:]]");
[[ -z "${_WORD}" ]] && _WORD="$(tr -cd '[:alpha:]' < /dev/urandom | fold -w10 | head -1)"
case "${1}" in
*h) echo -e "Usage:\\t$(basename $0) (-u|-U|-l)";;
*u) echo "${_WORD^}";;
*U) echo "${_WORD}" | tr '[[:lower:]]' '[[:upper:]]';;
*l) echo "${_WORD}" | tr '[[:upper:]]' '[[:lower:]]';;
"") echo "${_WORD}";;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment