Created
March 21, 2012 09:52
-
-
Save triangletodd/2145867 to your computer and use it in GitHub Desktop.
Random quote from bash.org in a random Cowsay template
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 | |
bashorg=$(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) | |
files=($(cowsay -l|sed 's#Cow files in /usr/share/cowsay/cows:##')) | |
num_files=${#files[@]} | |
cowsay -f "${files[$((RANDOM%num_files))]}" ${bashorg} | |
unset bashorg files num_files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment