3
<em>g.findfile</em> is designed for Bourne shell scripts that need to search
4
for mapset <em>elements</em>, including: raster, vector maps, region
5
definitions and <em><a href="i.group.html">imagery</a></em> groups.
7
The list of <em>element</em> names to search for is not fixed; any
8
subdirectory of the mapset directory is a valid <em>element</em> name.
10
However, the user can find the list of standard GRASS <em>element</em> names in
11
the file $GISBASE/etc/element_list. This is the file which
12
g.remove/g.rename/g.copy use to determine which files need to be
13
deleted/renamed/copied for a given entity type.
22
<dt><b>element=</b><em>name</em>
24
<dd>The data base element (i.e., directory within a GRASS
25
mapset) to be searched.
27
<dt><b>mapset=</b><em>name</em>
29
<dd>The mapset in which to search for the specified file
30
<em>name</em>. If not specified, all mapsets in the user's
31
GRASS search path are searched. Otherwise, the specified
32
mapset is searched. As a convenience, if specified as a
33
single dot (.) only the current mapset is searched.
35
<dt><b>file=</b><em>name</em>
37
<dd>The name of a GRASS data file (of the stated
38
<em>element</em> type) for which to search.
45
<em>g.findfile</em> writes four lines to standard output:
47
<div class="code"><pre>
48
name='<em>file_name</em>'
49
mapset='<em>mapset_name</em>'
50
file='<em>unix_filename</em>'
51
fullname='<em>grass_fullname</em>'
55
The output is <em>/bin/sh</em> commands to set the variable
56
<em>name</em> to the GRASS data base file name,
57
<em>mapset</em> to the mapset in which the file resides,
58
and <em>file</em> to the full UNIX path name for the named
59
file. These variables may be set in the <em>/bin/sh</em>
62
<div class="code"><pre>
63
eval `g.findfile element=name mapset=name file=name`
66
For example (raster map):
67
<div class="code"><pre>
68
eval `g.findfile element=cell file=mymap`
73
If the specified file does not exist, the variables will be set as follows:
75
<div class="code"><pre>
83
The following is a way to test for this case:
93
Note that region files are searched as <em>element=windows</em>.
97
<em><a href="g.ask.html">g.ask</a></em><br>
98
<em><a href="g.filename.html">g.filename</a></em><br>
99
<em><a href="g.gisenv.html">g.gisenv</a></em><br>
100
<em><a href="g.mapsets.html">g.mapsets</a></em><br>
101
<em><a href="parser.html">parser</a></em>
106
U.S.Army Construction Engineering Research Laboratory
108
<p><i>Last changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $</i>