Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: Bash  |  size: 0.34 KB  |  views: 1,025  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. # WTF ;)
  3.  
  4. wtf()
  5. {
  6.         tput cup $(($RANDOM % $1)) $(($RANDOM % $2))
  7.         tput setaf $(($RANDOM % 8))
  8.         echo -n $(($RANDOM % 2))
  9. }
  10.  
  11. sig_int_trap()
  12. {
  13.         tput sgr0
  14.         tput cnorm
  15.         exit 0
  16. }
  17.  
  18. init()
  19. {
  20.         trap sig_int_trap SIGINT
  21.         tput civis
  22. }
  23.  
  24. height=$(tput lines)
  25. width=$(tput cols)
  26.  
  27. init && while true; do wtf $height $width; done