Created
December 24, 2008 17:45
-
-
Save jashmenn/39729 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# runs ARGV and puts the output | |
# | |
# Example: | |
# ruby poller.rb date | |
# | |
# http://gist.github.com/39729 | |
module Screen | |
def self.clear | |
print "\e[H\e[2J" | |
end | |
end | |
trap("INT") { puts "Goodbye"; exit } | |
cmd = ARGV.join(" ") | |
poll_time = 1 | |
while(true) | |
Screen.clear | |
puts `#{cmd}` | |
sleep poll_time | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment