Advertisement
Guest User

Untitled

a guest
Jul 30th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1.  
  2. #!/bin/bash
  3.  
  4. #Reading speed in words per minute. Test at http://www.readingsoft.com/
  5. READSPEED=444
  6.  
  7. PAGE="$(curl http://vlasisku.lojban.org/vlasisku/${1})"
  8.  
  9. if [ "$(echo ${PAGE} | grep "I couldn't find you anything, sorry!" )" ]; then
  10. notify-send -i ${HOME}/.local/share/Lojban-Logo.svg "${1}" "No definition found."
  11. exit 1
  12. fi
  13.  
  14. DEFINITION=$(echo "${PAGE}"|grep definition|sed 's/<\/p*>//'|sed 's/ <p class=\"definition\">//'|sed 's/<sub>//g'|sed 's/<\/sub>//g')
  15. RAFSI=$(echo "${PAGE}"|grep hyphen|sed 's/ <span class="hyphen">//g'|sed 's/<span class="hyphen">//g'|sed 's/<\/span>//g')
  16.  
  17. i=0;
  18. for token in $DEFINITION; do
  19. i=$(($i + 1))
  20. done
  21.  
  22. SECONDS=$(( $(( $(( $i / $(( $READSPEED / 60 )))) * 1000)) + 2000))
  23.  
  24. notify-send -t ${SECONDS} -i ${HOME}/.local/share/Lojban-Logo.svg "${1} ${RAFSI}" "${DEFINITION}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement