Revision 16,
1.5 KB
checked in by marcus, 14 years ago
(diff) |
r1 | svn | 2007-12-13 11:10:29 +0100 (Do, 13 Dez 2007) | 2 lines
Initial import
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #! /bin/csh |
---|
2 | # |
---|
3 | # file insert_station_location.csh |
---|
4 | # =========================== |
---|
5 | # |
---|
6 | # version 1, 15-Nov-2003 |
---|
7 | # |
---|
8 | # Inserts/Modifies station location information ($SH_INPUTS/STATINF.DAT) |
---|
9 | # K. Stammler, 15-Nov-2003 |
---|
10 | |
---|
11 | set xprog=$SH_ROOT/setup |
---|
12 | |
---|
13 | set infofile=$SH_INPUTS/STATINF.DAT |
---|
14 | |
---|
15 | echo "" |
---|
16 | echo -n "Station name: " |
---|
17 | set station="$<" |
---|
18 | set station=`echo $station | sed y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/` |
---|
19 | |
---|
20 | set res=`grep "^$station " $infofile` |
---|
21 | |
---|
22 | if ("$res" == "") then |
---|
23 | |
---|
24 | set new_entry=1 |
---|
25 | set inp="y" |
---|
26 | |
---|
27 | else |
---|
28 | |
---|
29 | set new_entry=0 |
---|
30 | |
---|
31 | echo "Current entry of $station :" |
---|
32 | echo $res |
---|
33 | echo -n "change ? [y/n/d]: " |
---|
34 | set inp="$<" |
---|
35 | if ("$inp" != "y" && "$inp" != "d") then |
---|
36 | echo "No changes made." |
---|
37 | exit |
---|
38 | endif |
---|
39 | |
---|
40 | endif |
---|
41 | |
---|
42 | if ("$inp" != "d") then |
---|
43 | echo -n "Latitude of ${station} (southern latitudes negative please): " |
---|
44 | set lat="$<" |
---|
45 | echo -n "Longitude of ${station} (western longitudes negative please): " |
---|
46 | set lon="$<" |
---|
47 | echo -n "Elevation in m: " |
---|
48 | set elev="$<" |
---|
49 | |
---|
50 | if ("$elev" == "") set elev="0.0" |
---|
51 | if ("$lat" == "" || "$lon" == "") then |
---|
52 | echo "Illegal input. No changes made." |
---|
53 | exit |
---|
54 | endif |
---|
55 | endif |
---|
56 | |
---|
57 | if ($new_entry == 1) then |
---|
58 | |
---|
59 | if (-e $infofile.x) \rm $infofile.x |
---|
60 | mv $infofile $infofile.x |
---|
61 | |
---|
62 | else |
---|
63 | |
---|
64 | if (-e $infofile.x) \rm $infofile.x |
---|
65 | grep -v "^$station " $infofile >$infofile.x |
---|
66 | \rm $infofile |
---|
67 | if ("$inp" == "d") then |
---|
68 | mv $infofile.x $infofile |
---|
69 | echo "Station $station deleted from location file." |
---|
70 | exit |
---|
71 | endif |
---|
72 | |
---|
73 | endif |
---|
74 | |
---|
75 | echo "$station lat:$lat lon:$lon elevation: $elev" >$infofile |
---|
76 | cat $infofile.x >>$infofile |
---|
77 | \rm $infofile.x |
---|
78 | |
---|
Note: See
TracBrowser
for help on using the repository browser.