myradar: a companion to myforecast
by Andrew Newman
One of a series of example shells:
This contribution is an extremely simple bash shell that I wrote for calling up the local
doppler radar map from Wunderground.com.
myradar:
#!/bin/bash
# program myradar
# version 1.0
# written by Andrew V. Newman
# last modified Tue Tue Mar 2 17:21:01 MST 2004
# shell script to bring up a current local radar
# Sets a default URL BASE
# NOTE: If you want to change this for your local area, go to
# wunderground.com and find the correct URL for your area.
# I modified mine quite a bit so as to only show the gif image
# with the full delay and number of images available. The only important value
# that needs to be changed to get your area but have it look like mine is the
# "ABX" in my URL path. For example, switch 'ABX' to 'LOT' to get Chicago.
URL="http://radblast.wunderground.com/cgi-bin/radar/WUNIDS?station=FFC&num=6&delay=15&noclutter=0"
# Set the default graphical browser
# I like galeon, but it may not be installed on your machine.
GUI_BROWSER=/usr/bin/firefox
# ---------------------------- #
# If you can display a window on your terminal it will
# bring up your forecast in a graphical browser
if [ $DISPLAY ]; then
$GUI_BROWSER $URL 2> /dev/null
# Otherwise, it cannot work for you
else
echo "Sorry cannot bring up a display :("
exit 1
fi
# exit cleanly
exit 0
A copy of this script exists in /home/anewman/bin/myradar on terremoto
Once you have finished creating this file all you need to do is:
- Change permissions of the file so that you can execute it:
% chmod 755 myradar
- Move file to a directory in your path:
I would suggest creating a bin directory from your home for all
shells and then making certain it is included in your path.
% mkdir ~/bin % mv myradar ~/bin/
If it is not already there, add the following line to ~/.cshrc if you are using a csh or tcsh shell
path = ( $path ~/bin)
Or, if you are using bash add the following line to ~/.bashrc
PATH=$PATH:~/bin
If you followed the instructions in the commented area, you should be able to switch
the radar image to your area. Now that you have set your defaults, give the program a shot. Try running the following command:
% myradar
Course Home | anewman gatech.edu | Updated:
Mon Sep 18 18:03:31 EDT 2006
|