## NAME

g.ask

## 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 12:29:50 +0100 (Tue, 08 Nov 2011) $

Main index - general index - Full index

© 2003-2011 GRASS Development Team