## 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.

## OPTIONS

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.

### 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 file=name`

## 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
parser

## AUTHOR

Michael Shapiro, U.S.Army Construction Engineering Research Laboratory

Last changed: $Date: 2003/07/04 08:35:34 $