.TH g.findfile 1grass "" "GRASS 6.4.2" "Grass User's Manual" .SH NAME \fI\fBg.findfile\fR\fR - Searches for GRASS data base files and sets variables for the shell. .SH KEYWORDS general, map management .SH SYNOPSIS \fBg.findfile\fR .br \fBg.findfile help\fR .br \fBg.findfile\fR [-\fBn\fR] \fBelement\fR=\fIstring\fR \fBfile\fR=\fIstring\fR [\fBmapset\fR=\fIstring\fR] [--\fBverbose\fR] [--\fBquiet\fR] .SS Flags: .IP "\fB-n\fR" 4m .br Don't add quotes .IP "\fB--verbose\fR" 4m .br Verbose module output .IP "\fB--quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBelement\fR=\fIstring\fR" 4m .br Name of an element .IP "\fBfile\fR=\fIstring\fR" 4m .br Name of an existing map .IP "\fBmapset\fR=\fIstring\fR" 4m .br Name of a mapset .br Default: \fI\fR .PP .SH DESCRIPTION \fIg.findfile\fR is designed for Bourne shell scripts that need to search for mapset \fIelements\fR, including: raster, vector maps, region definitions and \fIimagery\fR groups. .PP The list of \fIelement\fR names to search for is not fixed; any subdirectory of the mapset directory is a valid \fIelement\fR name. .PP However, the user can find the list of standard GRASS \fIelement\fR names in the file $GISBASE/etc/element_list. This is the file which g.remove/g.rename/g.copy use to determine which files need to be deleted/renamed/copied for a given entity type. .SH OUTPUT \fIg.findfile\fR writes four lines to standard output: \fC .DS .br name='\fIfile_name\fR' .br mapset='\fImapset_name\fR' .br file='\fIunix_filename\fR' .br fullname='\fIgrass_fullname\fR' .br .DE \fR The output is \fI/bin/sh\fR commands to set the variable \fIname\fR to the GRASS data base file name, \fImapset\fR to the mapset in which the file resides, and \fIfile\fR to the full UNIX path name for the named file. These variables may be set in the \fI/bin/sh\fR as follows: \fC .DS .br eval \(gag.findfile element=name mapset=name file=name\(ga .br .DE \fR .PP For example (raster map): \fC .DS .br eval \(gag.findfile element=cell file=mymap\(ga .br .DE \fR .SH NOTES If the specified file does not exist, the variables will be set as follows: \fC .DS .br name= .br mapset= .br fullname= .br file= .br .DE \fR The following is a way to test for this case: \fC .DS .br if [ ! "$file" ] .br then .br exit .br fi .br .DE \fR Note that region files are searched as \fIelement=windows\fR. .SH SEE ALSO \fIg.ask\fR .br \fIg.filename\fR .br \fIg.gisenv\fR .br \fIg.mapsets\fR .br \fIparser\fR .SH AUTHOR Michael Shapiro, U.S.Army Construction Engineering Research Laboratory .PP \fILast changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $\fR .PP Full index .PP © 2003-2011 GRASS Development Team