Debian Codegraph @

misc/getxmlobs

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 BASE_URL="http://www.weather.gov/xml/current_obs"
4
5 usagescip-shell shell shell-project 0.0.0 usage(). () {
6 echoscip-shell system . . echo. "Usage: $0 <station> [ <station> ... ]"
7 exit 1
8 }
9
10 date=`datescip-shell system . . date. -u '+%y%m%d'`
11 hour=`datescip-shell system . . date. -u '+%H'`
12
13 stations=""
14 while [scip-shell system . . `[`. "$#" -gt 0 ]; do
15 case $1 in
16 -*)
17 echoscip-shell system . . echo. "unrecognized option: $1"
18 usagescip-shell shell shell-project 0.0.0 usage().;;
19 [A-Z][A-Z0-9][A-Z0-9][A-Z0-9])
20 stations="$stations $1"
21 shift;;
22 esac
23 done
24
25 if [scip-shell system . . `[`. -z "$stations" ]; then
26 usagescip-shell shell shell-project 0.0.0 usage().
27 fi
28
29 for name in $stations; do
30 file="$name-${date}-${hour}Z.xml"
31 echoscip-shell system . . echo. "Downloading observations for station $name into $file"
32 curlscip-shell system . . curl. -s -S -R "$BASE_URL/${name}.xml" -o "$file"
33 done
34