[GRASSLIST:2315] Re: Grass57 debuglevel

Glynn Clements glynn.clements at virgin.net
Wed Jan 21 20:43:54 EST 2004


Sjors wrote:

> As I'm new to programming and still learning some aspects of programming 
> for Grass are complicated and strange. Luckily I got some help from a 
> freind how is a far better programmer then I am. After 3 days we figured 
> it out. This not documented well, regard the following
> //
> 
> > On Sunday 18 January 2004 18:02, Christopher Fonnesbeck wrote:
> > /> Try using: /
> > /> /
> > /> g.gisenv set=DEBUG=9 /
> > /> /
> > /> for debug level 9, for example. /
> >
> > Currently the maximum debug level used is 5, AFAIK.
> >
> This is right but the environment variable GRASS_DEBUG_FILE should be 
> put in .bashrc or .bash_profile and not in .grassrc57. This is a bit 
> confusing and we figured it out by looking at the debug code and the 
> fact that a day later it all went wrong again. The first day we first 
> tried to do it by putting it all in .bash_profile. Environment variable 
> handling in Grass is very very complicated!!!!!!!!!

The handling of environment variables in Grass is no different to in
any other program.

However, the issue is complicated by the fact that GRASS uses "GRASS
variables" as well as environment variables. Not only that, but much
of the documentation and some function and program names appear to
confuse the two.

GRASS variables are stored in the file referenced by $GISRC (which
defaults to ~/.grassrc5 for 5.0/5.3 and ~/.grassrc57 for 5.7), and can
be read or written using the g.gisenv program (and, at the C level,
through G_getenv(), G_setenv() etc).

Environment variables are an OS feature. Each process inherits a list
of environment variables from its parent. GRASS modules will inherit
any environment variables which are set in the shell started by the
"grass5" or "grass57" scripts, which in turn will inherit any
environment variables which are set in the shell from which the
grass5/grass57 scripts are run.

Shells invariably have a command to set environment variables (e.g. 
"export" for Bourne shells, "setenv" for C shells); they also read
shell commands from a file at startup (the question of exactly *which*
file can be quite involved; consult your shell's manual page for
details).

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list