Skip to content

Instantly share code, notes, and snippets.

@armcknight
Forked from triangletodd/bashorg_cowsay.sh
Last active May 19, 2017 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armcknight/ee2ec806ae624babd999688e2a75d3ec to your computer and use it in GitHub Desktop.
Save armcknight/ee2ec806ae624babd999688e2a75d3ec to your computer and use it in GitHub Desktop.
Retrieve a random quote from bash.org and pipe into macOS' say command. Probs not NSFW.
curl -s http://bash.org/?random1 \
| grep -oE "<p class=\"quote\">.*</p>.*</p>" \
| grep -oE "<p class=\"qt.*?</p>" \
| sed -e 's/<\/p>/\n/g' -e 's/<p class=\"qt\">//g' -e 's/<p class=\"qt\">//g' \
| perl -ne 'use HTML::Entities;print decode_entities($_),"\n"' \
| head -1 \
| say
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment