Skip to content

Instantly share code, notes, and snippets.

@crahan
Created August 25, 2014 22:23
Show Gist options
  • Save crahan/8fd5d4532590dbddd3f9 to your computer and use it in GitHub Desktop.
Save crahan/8fd5d4532590dbddd3f9 to your computer and use it in GitHub Desktop.
Get a random quote from quotedb.com
#!/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
@serheang
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment