dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 564f976f0386d41bf92a9fe69390cbbe281ad624
parent 79e7136317371b09c59c49dd5604399b1100d7b5
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 18 Jan 2019 22:19:51 +0100

Allow forecast script to accept default zipcode as command line option

Diffstat:
Mlinks/bin/forecast | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/links/bin/forecast b/links/bin/forecast @@ -2,10 +2,6 @@ # vim: ft=sh: set -e -# DMI -#zipcode=7700 # Thisted -zipcode=9520 # Skoerping -url="http://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=${zipcode}&mode=long&eps=true" # NWS: Plainsboro #url='http://f1.weather.gov/meteograms/Plotter.php?lat=40.3308&lon=-74.5647&wfo=PHI&zcode=NJZ012&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=0&pcmd=11011111111110100000000000000000000000000000000000000000000&lg=en&indu=3!1!1!&dd=&bw=&hrspan=48&pqpfhr=6&psnwhr=6' @@ -17,16 +13,27 @@ elif command -v xdg-open &>/dev/null; then else open="echo" fi +# DMI +#zipcode=7700 # Thisted +default_zipcode=9520 # Skoerping + +function get_url { + echo "http://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=${1}&mode=long&eps=true" +} if [ $# -gt 0 ]; then if [ "$1" == "radar" ]; then $open "http://www.dmi.dk/vejr/maalinger/radar-nedboer/" exit 0 elif [ "$1" == "3-9" ]; then - url="http://servlet.dmi.dk/byvejr/servlet/byvejr?by=${zipcode}&tabel=dag3_9&eps=true" + url="http://servlet.dmi.dk/byvejr/servlet/byvejr?by=${default_zipcode}&tabel=dag3_9&eps=true" elif [ "$1" == "wind" ]; then url="http://servlet.dmi.dk/bv/servlet/bvImage?stat=6065&param=wind" + else + url=$(get_url $1) fi +else + url=$(get_url $default_zipcode) fi tmpfile=$(mktemp).png