Note: This document is for an older version of GRASS GIS that is outdated. You should upgrade, and read the current manual page.
NAME
g.ask - Prompts the user for the names of GRASS data base files.
KEYWORDS
general, map management
SYNOPSIS
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="string"
- The prompt to be displayed to the user
- element=string
- The database element to be queried
- desc="string"
- A short description of the database element
- unixfile=string
- The name of a unix file to store the user's response
DESCRIPTION
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.
OUTPUT
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.
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:
name=
mapset=
fullname=
file=
The following is a way to test for this case:
if [ ! "$file" ]
then
exit
fi
SEE ALSO
d.ask,
g.filename,
g.findfile,
g.gisenv,
g.parser
AUTHOR
Michael Shapiro,
U.S.Army Construction Engineering Research Laboratory
Last changed: $Date: 2011-11-08 03:23:06 -0800 (Tue, 08 Nov 2011) $
Main index - general index - Full index
© 2003-2014 GRASS Development Team