#! /bin/sh # Display Space Shuttle countdown clock # by John Walker # http://www.fourmilab.ch/ # October 15, 1995 # countdown [seconds] # The clock is updated every [seconds] seconds. If no argument is # given, it's updated every minute. A beep is sent to the terminal # when the status changes between "Holding" and "Counting". You can # supply a command to play a sound file in lieu of the beep. # NASA URL providing the clock URL=http://www.ksc.nasa.gov/htbin/cdt_clock.pl # Command used to retrieve the above URL #cmd="www -n -source" # CERN line-mode browser cmd="lynx -source" # LYNX #cmd="http_get" # Jef Poskanzer's http_get program # If not null, command to play sound file when status changes # sound="cp /usr/lib/sounds/whatever.au /dev/audio" # You shouldn't have to change anything below this line. if [ x$1 = x ] then freq=60 else freq=$1 fi stat= while true do wallclock=`date +%T` mung=`$cmd $URL | grep Minutes | \ sed "s/.*H2> /$wallclock: /" | sed "s/ <.*$/Z/"` echo -n `echo $mung | tr "Z" "\015"` s=`echo $mung | sed "s/.*and //"` if [ x$stat != x -a x$s != x$stat ] then if [ "x$sound" != x ] then $sound else echo -n `echo XXXXX | tr "X" "\007"` fi fi stat=$s sleep $freq done