Provided by: grass-doc_6.4.3-3_all
g.ask - Prompts the user for the names of GRASS data base files.
general, map management
g.ask g.ask help g.ask type=string [prompt="string"] element=string [desc="string"] unixfile=string [--verbose] [--quiet] Parameters: type=string The type of query Options: old,new,any,mapset prompt= The prompt to be displayed to the user element=string The database element to be queried desc= A short description of the database element unixfile=string The name of a unix file to store the user's response
g.ask 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 g.ask is invoked with needed parameters, it will query the user for a file name of the specified type and element. After the user responds to this query, the program will write four lines to the UNIX output file specified by unixfile.
Upon receiving the user's response to its request for a file name, g.ask writes four lines to the specified unixfile; this output file is placed in the user's current working directory, unless otherwise specified, and contains the following lines: name='some_name' mapset='some_mapset' fullname='some_fullname' file='some_fullpath' The output is /bin/sh commands to set the variable name to the file name specified by the user (of the element and type requested by g.ask), mapset to the GRASS mapset in which this file resides (or will be created), fullname is the name with the mapset embedded in it, and file to the full UNIX path name identifying this file. These variables may be set in the /bin/sh as follows: . unixfile The . is a shell command which means read the unixfile and execute the commands found there. It is NOT part of the unixfile name and MUST be followed by a space.
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: name= mapset= fullname= file= The following is a way to test for this case: if [ ! "$file" ] then exit fi
d.ask, g.filename, g.findfile, g.gisenv, g.parser
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory Last changed: $Date: 2011-11-08 03:29:50 -0800 (Tue, 08 Nov 2011) $ Full index © 2003-2013 GRASS Development Team