Skip to content

Instantly share code, notes, and snippets.

@posva
Created May 17, 2013 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save posva/5601518 to your computer and use it in GitHub Desktop.
Save posva/5601518 to your computer and use it in GitHub Desktop.
Color formatted code for zsh (may work in other terminals) to display a random quote from http://www.quotationspage.com/random.php3
#! /bin/zsh
Q=$(curl -s "http://www.quotationspage.com/random.php3" | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
echo "\e[0;33m${W}\033[0\e[0;30m: \e[0;35m“${TXT}”\e[m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment