Alexander Nasonov's shared items

Thursday, November 23, 2006

Quote generator

I'm a happy user of mutt but I always wanted dynamically generated signature with a cool content. And I finally did it! This simple script retrieves a random quote from www.quotedb.com, formats it and finally prints most interesting part of itself:
#!/bin/sh
cat ~/.signature
/usr/pkg/bin/curl -L http://tinyurl.com/veusy           | sed -e 's/^document\.write(.//' -e 's/.);$//'             -e 's/<[^>]*>//g' -e 's/^More quotes from //'   | fmt | tee ~/.signature-quote
echo ""
echo "This quote is generated by: "
cat -n $0 | grep -e '^[ ]*[3-6]' | sed 's/^[ ]*[0-9]*[ ]*//'
A typical result looks like this:
--
Alexander Nasonov
http://nasonov.blogspot.com

Diligence is the mother of good luck.  Benjamin Franklin

This quote is generated by:
      /usr/pkg/bin/curl -L http://tinyurl.com/veusy                 | sed -e 's/^document\.write(.//' -e 's/.);$//'                   -e 's/<[^>]*>//g' -e 's/^More quotes from //'         | fmt | tee ~/.signature-quote

No comments:

Post a Comment