.TH g.ask 1grass "" "GRASS 6.4.2" "Grass User's Manual" .SH NAME \fI\fBg.ask\fR\fR - Prompts the user for the names of GRASS data base files. .SH KEYWORDS general, map management .SH SYNOPSIS \fBg.ask\fR .br \fBg.ask help\fR .br \fBg.ask type\fR=\fIstring\fR [\fBprompt\fR=\fI"string"\fR] \fBelement\fR=\fIstring\fR [\fBdesc\fR=\fI"string"\fR] \fBunixfile\fR=\fIstring\fR [--\fBverbose\fR] [--\fBquiet\fR] .SS Parameters: .IP "\fBtype\fR=\fIstring\fR" 4m .br The type of query .br Options: \fIold,new,any,mapset\fR .IP "\fBprompt\fR=\fI"string"\fR" 4m .br The prompt to be displayed to the user .IP "\fBelement\fR=\fIstring\fR" 4m .br The database element to be queried .IP "\fBdesc\fR=\fI"string"\fR" 4m .br A short description of the database element .IP "\fBunixfile\fR=\fIstring\fR" 4m .br The name of a unix file to store the user's response .PP .SH DESCRIPTION \fIg.ask\fR is designed for shell scripts that need to prompt the user for the name of a data base file in the user's current GRASS location. After \fIg.ask\fR is invoked with needed parameters, it will query the user for a file name of the specified \fItype\fR and \fIelement\fR. After the user responds to this query, the program will write four lines to the UNIX output file specified by \fIunixfile\fR. .SH OUTPUT Upon receiving the user's response to its request for a file name, \fIg.ask\fR writes four lines to the specified \fIunixfile\fR; this output file is placed in the user's current working directory, unless otherwise specified, and contains the following lines: \fC .DS .br name='\fIsome_name\fR' .br mapset='\fIsome_mapset\fR' .br fullname='\fIsome_fullname\fR' .br file='\fIsome_fullpath\fR' .br .DE \fR .PP The output is \fI/bin/sh\fR commands to set the variable \fIname\fR to the file name specified by the user (of the \fIelement\fR and \fItype\fR requested by \fIg.ask\fR), \fImapset\fR to the GRASS mapset in which this file resides (or will be created), \fIfullname\fR is the name with the mapset embedded in it, and \fIfile\fR to the full UNIX path name identifying this file. These variables may be set in the \fI/bin/sh\fR as follows: \fB. unixfile\fR .PP .PP The . is a shell command which means read the \fIunixfile\fR and execute the commands found there. It is NOT part of the \fIunixfile\fR name and MUST be followed by a space. .SH NOTES The user may choose to simply hit the return key and not enter a file name. If this happens the variables will be set as follows: \fC .DS .br name= .br mapset= .br fullname= .br file= .br .DE \fR .PP The following is a way to test for this case: \fC .DS .br if [ ! "$file" ] .br then .br exit .br fi .br .DE \fR .SH SEE ALSO \fId.ask\fR, \fIg.filename\fR, \fIg.findfile\fR, \fIg.gisenv\fR, \fIg.parser\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