[GRASSLIST:855] Re: fast start
glynn.clements at virgin.net
Tue Jul 29 10:59:51 EDT 2003
> Is there a short way to start grass5 at once (and/or tcltkgrass GUI)
> with a single line command something like "grass5 mapset=blah
> location=blahblah" ?
> What parameters should I pass to stdin of grass5 if I want to start it
> from within a script ?
Pass the complete path to the mapset directory, e.g.
If you want to use it from within a script, you probably don't want it
to start an interactive shell. In that case, you need to set the
environment variable SHELL to the path to a script, e.g.
SHELL=/path/to/script grass5 /opt/grass-data/spearfish/mymapset
Alternatively, paste the relevant chunks of the grass5 script and
$GISBASE/etc/Init.sh into your own script.
Basically, in order for GRASS commands to work, certain environment
variables need to be set. Primarily:
1. GISBASE needs to point to the root of the the GRASS installation
2. GISRC needs to point to a file (e.g. ~/.grassrc5) containing the
session parameters (at least GISDBASE, LOCATION_NAME and MAPSET need
to be set). If you don't specific the mapset directory on the command
line, Init.sh uses either etc/set_data (text mode) or gis_set.tcl
(Tcl/Tk) to initialise the contents of this file.
A few other environment variables are used by specific commands; look
at $GISBASE/etc/Init.sh for the details.
Apart from initialising environment variables and the $GISRC file, the
other tasks which Init.sh performs are creating the lock file
~/.gislock5, and spawning the shell.
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user