[GRASS-dev] [GRASS GIS] #3462: Allow setting environment variables in grass startup script

GRASS GIS trac at osgeo.org
Sat Dec 16 03:41:06 PST 2017

#3462: Allow setting environment variables in grass startup script
  Reporter:  mankoff      |      Owner:  grass-dev@…
      Type:  enhancement  |     Status:  new
  Priority:  major        |  Milestone:
 Component:  Default      |    Version:  7.2.2
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  MacOSX

Comment (by mankoff):

 My shell is `/bin/bash`.

 I have the following in `~/.grass.bashrc`:

 echo ".grass.bashrc"
 export FOO=42
 export DYLD_LIBRARY_PATH=/opt/local/share/grass-7.2.2/lib

 And this in `~/.grass7/bashrc`:


 echo ".grass7/bashrc"
 export BAR=42
 export DYLD_LIBRARY_PATH=/opt/local/share/grass-7.2.2/lib

 And when I launch grass with: `grass72 -c ./Gtmp`, I see the following:



 GRASS 7.2.2 (Gtmp):~ > echo $FOO

 GRASS 7.2.2 (Gtmp):~ > echo $BAR
 GRASS 7.2.2 (Gtmp):~ > echo $DYLD_LIBRARY_PATH

 GRASS 7.2.2 (Gtmp):~ >

 If I comment out the line that blocks `export` statements in my startup
 file, both `FOO` and `DYLD_LIBRARY_PATH` are correctly set. Is the `DYLD`
 issue related to the following? What is going on on line 564:

     # Set LD_LIBRARY_PATH (etc) to find GRASS shared libraries
     # this works for subprocesses but won't affect the current process
     path_prepend(gpath("lib"), ld_library_path_var)

Ticket URL: <https://trac.osgeo.org/grass/ticket/3462#comment:6>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list