Created
August 25, 2014 22:23
-
-
Save crahan/8fd5d4532590dbddd3f9 to your computer and use it in GitHub Desktop.
Get a random quote from quotedb.com
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/sh | |
# try to pull in a new quote from quotedb.com | |
newquote=`curl -s http://www.quotedb.com/quote/quote.php?action=random_quote` | |
# did it succeed? | |
if [ $? -eq 0 ]; then | |
# ok, curl was able to pull in a new quote. Parse and cache it | |
echo $newquote | sed "s/^document.write('\(.*\)<br>.*<a.*>\(.*\)<\/a.*;$/\"\1\" - \2/" > ~/.qotd | |
fi | |
cat ~/.qotd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you