g.gisenv(1grass) | GRASS GIS User's Manual | g.gisenv(1grass) |
g.gisenv - Outputs and modifies the user’s
current GRASS variable settings.
Prints all defined GRASS variables if no option is given.
general, settings, variables, scripts
g.gisenv
g.gisenv --help
g.gisenv [-sn]
[get=variable[,variable,...]]
[set="variable=value"]
[unset=variable[,variable,...]]
[store=string] [separator=character]
[--help] [--verbose] [--quiet] [--ui]
When a user runs GRASS, certain variables are set specifying the GRASS data base, location, mapset, peripheral device drivers, etc., being used in the current GRASS session. These variable name settings are recognized as long as the user is running a GRASS session.
No prompts are given to the user when running g.gisenv.
If run without arguments, g.gisenv lists all of the
user’s current GRASS variable settings. Results are sent to standard
output, and may look like this:
GISDBASE=/opt/grassdata/ LOCATION_NAME=nc_spm_08_grass7 MAPSET=/user1 GUI=gui
If the user specifies a get=variable_name on the
command line
g.gisenv MAPSETonly the value for that particular GRASS variable is output to standard output. Possible variable names depend on the user’s system, see variables list for details. Note that the variable names are case-insensitive.
While other variables may be associated with each GRASS session (e.g., GRASS_GUI, GIS_LOCK, and other variables), those stated below are essential.
Each "mapset" stores GRASS data base elements (i.e., the directories in which GRASS data files are stored). Any maps created or modified by the user in the current GRASS session will be stored here. The MAPSET directory PERMANENT is generally reserved for the set of maps that form the base set for all users working under each LOCATION_NAME.
Once within a GRASS session, GRASS users have access only to the data under a single GRASS data base directory (the current GRASS data base, specified by the variable GISDBASE), and to a single GRASS location directory (the current location, specified by the variable LOCATION_NAME). Within a single session, the user may only modify the data in the current mapset (specified by the variable MAPSET), but may use data available under other mapsets under the same LOCATION_NAME.
All of these names must be legal names on the user’s current system.
The full path to the current mapset is determined from
GISDBASE, LOCATION_NAME, MAPSET variables, in the
example above: /opt/grassdata/spearfish/PERMANENT. The full path can be
printed using g.gisenv by providing multiple variables:
g.gisenv get=GISDBASE,LOCATION_NAME,MAPSET sep=’/’ /opt/grassdata/nc_spm_08_grass7/user1
The output from g.gisenv when invoked without arguments is
directly usable by Bash. The following command will cast each variable into
the UNIX environment:
eval `g.gisenv`
This works only for Bash, sh, ksh, etc. The format of the output is not compatible with some other UNIX shells.
By default the GRASS variables are stored in gisrc file (defined by environmental variable GISRC). If store=mapset is given then the variables are stored in <gisdbase>/<location>/<mapset>/VAR after the current GRASS session is closed.
To print debugging messages, the variable DEBUG must be set
to level equal or greater than 0:
g.gisenv set="DEBUG=3"
Levels: (recommended levels)
g.gisenv unset="DEBUG"
The variable DEBUG controls debugging messages from GRASS libraries and modules.
Similarly WX_DEBUG controls debugging messages from wxGUI.
g.access, g.filename, g.findfile, g.mapsets
See also variables list
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
Available at: g.gisenv source code (history)
Accessed: Monday Apr 01 03:07:18 2024
Main index | General index | Topics index | Keywords index | Graphical index | Full index
© 2003-2024 GRASS Development Team, GRASS GIS 8.3.2 Reference Manual
GRASS 8.3.2 |