1g.findfile(1) Grass User's Manual g.findfile(1)
2
3
4
6 g.findfile - Searches for GRASS data base files and sets variables for
7 the shell.
8
10 general
11
13 g.findfile
14 g.findfile help
15 g.findfile element=string [mapset=string] file=string
16
17 Parameters:
18 element=string
19 Name of an element
20
21 mapset=string
22 Name of a mapset Default:
23
24 file=string
25 Name of an existing map
26
28 g.findfile is designed for Bourne shell scripts that need to search for
29 mapset elements, including: raster, vector maps, region definitions and
30 imagery groups.
31
32 The list of element names to search for is not fixed; any subdirectory
33 of the mapset directory is a valid element name.
34
35 However, the user can find the list of standard GRASS element names in
36 the file $GISBASE/etc/element_list. This is the file which
37 g.remove/g.rename/g.copy use to determine which files need to be
38 deleted/renamed/copied for a given entity type.
39
41 g.findfile writes four lines to standard output:
42 name='file_name'
43 mapset='mapset_name'
44 file='unix_filename'
45 fullname='grass_fullname'
46 The output is /bin/sh commands to set the variable name to the GRASS
47 data base file name, mapset to the mapset in which the file resides,
48 and file to the full UNIX path name for the named file. These vari‐
49 ables may be set in the /bin/sh as follows:
50 eval `g.findfile element=name mapset=name file=name`
51
52
53 For example (raster map):
54 eval `g.findfile element=cell file=mymap`
55
56
58 If the specified file does not exist, the variables will be set as fol‐
59 lows:
60 name=
61 mapset=
62 fullname=
63 file=
64 The following is a way to test for this case:
65 if [ ! "$file" ]
66 then
67 exit
68 fi
69 Note that region files are searched as element=windows.
70
72 g.ask
73 g.filename
74 g.gisenv
75 g.mapsets
76 parser
77
79 Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
80
81 Last changed: $Date: 2007/01/18 17:29:43 $
82
83 Full index
84
85
86
87GRASS 6.2.2 g.findfile(1)