g.findfile
GRASS Reference Manual
g.findfile NAME g.findfile - Searches for GRASS data base files and sets variables for the shell. (GRASS File Management Program) SYNOPSIS g.findfile g.findfile help g.findfile element=name [mapset=name] file=name DESCRIPTION g.findfile is designed for Bourne shell scripts that need to search for raster map layer files, vector files, site list files, geographic region definition (windows) files, and imagery group files in the GRASS data base. If the user runs g.findfile without command line arguments, he will be prompted for the names of a GRASS element, file, and mapset, through the standard parser interface (see manual entry for parser). Parameters: element=name The data base element (i.e., directory within a GRASS mapset) to be searched. mapset=name The mapset in which to search for the specified file name. If not specified, all mapsets in the user's GRASS search path are searched. Otherwise, the specified mapset is searched. As a convenience, if specified as a single dot (.) only the current mapset is searched. file=name The name of a GRASS data file (of the stated element type) for which to search. OUTPUT g.findfile writes four lines to standard output: name='file_name' mapset='mapset_name' file='unix_filename' fullname='grass_fullname' The output is /bin/sh commands to set the variable name to the GRASS data base file name, mapset to the mapset in which the file resides, and file to the full UNIX path name for the named file. These variables may be set in the /bin/sh as follows: eval `g.findfile element=name mapset=name name=name` GRASS 5.0beta6 GRASS Development Team 1 g.findfile
GRASS Reference Manual
g.findfile NOTES If the specified file does not exist, the variables will be set as follows: name= mapset= fullname= file= The following is a way to test for this case: if [ ! "$file" ] then exit fi SEE ALSO g.ask, g.filename, g.gisenv, g.mapsets, and parser AUTHOR Michael Shapiro, U.S. Army Construction Engineering Research Laboratory 2 GRASS Development Team GRASS 5.0beta6