man g.findfile () - Searches for GRASS data base files and sets variables for the shell.

NAME

g.findfile - Searches for GRASS data base files and sets variables for the shell.

SYNOPSIS

g.findfile

g.findfile help

g.findfile element=string [mapset=string] file=string

Parameters:

"element=string
Name of an element
"mapset=string
Name of a mapset Default:
"file=string
Name of an existing map

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

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/05/24 21:08:04 $

Help Index