[GRASS-user] GRASS 7 shell environment variables and prompt settings

Hello everyone,

I’m using Grass 7.0.1 under Ubuntu 14.04 with the ubuntugis-unstable PPA enabled, I have a .grass.bashrc file where I define some shell environment variables according to the manual 1:

$ cat .grass.bashrc
export GRASS_PAGER=more

However, when I issue g.list rast inside Grass I get the list of raster maps in a less-type viewer.

echo $GRASS_PAGER

pager

And I have to manually set the ‘GRASS_PAGER’ to ‘more’ each time I start Grass, this was working in 6.4 but stopped working in 7.0.1, if there’s a new way of achieving this, then the manual is outdated.

Also, I’d like to know how to modify the prompt inside Grass, in 6.4 I added a PS1 variable with my custom prompt (with colors and a new line before the ‘>’) but it doesn’t seem to work in 7.0.1, what would be the best way to get my prompt to be like this:

GRASS 7.0.1 (UTM18N):~

g.list type=raster

Thanks in advance

···

César Augusto Ramírez Franco
Laboratorio de Sistemas Complejos Naturales
Escuela de Geociencias - Facultad de Ciencias
Universidad Nacional de Colombia - Sede Medellín
Teléfono: (57-4) 430 9369 - 300 459 6085

http://labscn-unalmed.github.io/

Hi,

2015-11-26 17:55 GMT+01:00 César Augusto Ramírez Franco <caesarivs@gmail.com>:

I'm using Grass 7.0.1 under Ubuntu 14.04 with the ubuntugis-unstable PPA
enabled, I have a .grass.bashrc file where I define some shell environment
variables according to the manual [1]:

$ cat .grass.bashrc
export GRASS_PAGER=more

try to put this line to

.grass7/bashrc

[1]:
http://grass.osgeo.org/grass70/manuals/variables.html#setting-shell-environment-variables

I will fix the manual. Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hello Martin

···

2015-11-26 18:08 GMT-05:00 Martin Landa <landa.martin@gmail.com>:

export GRASS_PAGER=more

try to put this line to

.grass7/bashrc

​This worked for the shell environmental variables, thanks a lot​

However, as stated in my first mail, I’d like to customize my Grass prompt to add colors and a newline before the ‘>’, how can this be achieved? I tried adding a PS1 definition inside the bashrc file but it didn’t work​​

Thanks in advance

César Augusto Ramírez Franco
Laboratorio de Sistemas Complejos Naturales
Escuela de Geociencias - Facultad de Ciencias
Universidad Nacional de Colombia - Sede Medellín
Teléfono: (57-4) 430 9369 - 300 459 6085

http://labscn-unalmed.github.io/

On Fri, Nov 27, 2015 at 5:18 PM, César Augusto Ramírez Franco
<caesarivs@gmail.com> wrote:

Hello Martin

2015-11-26 18:08 GMT-05:00 Martin Landa <landa.martin@gmail.com>:

> export GRASS_PAGER=more

try to put this line to

.grass7/bashrc

This worked for the shell environmental variables, thanks a lot

However, as stated in my first mail, I'd like to customize my Grass prompt
to add colors and a newline before the '>', how can this be achieved? I
tried adding a PS1 definition inside the bashrc file but it didn't work

It needs to be added
$HOME/.grass7/bashrc

see
https://grass.osgeo.org/grass70/manuals/variables.html#setting-shell-environment-variables

but indeed, also for me it fails.

I see that
userhome, ".grass.bashrc"

is still in place:

[neteler@oboe init]$ grep bashrc *
grass.py: grass_env_file = os.path.join(grass_config_dir, 'bashrc')
grass.py: grass_env_file = os.path.join(grass_config_dir, 'bashrc')
grass.py: # instead of changing $HOME, start bash with: --rcfile
"$LOCATION/.bashrc" ?
grass.py: # if so, must care be taken to explicity call
.grass.bashrc et al for
grass.py: home = location # save .bashrc in $LOCATION
grass.py: bashrc = os.path.join(home, ".bashrc")
grass.py: try_remove(bashrc)
grass.py: f = open(bashrc, 'w')
grass.py: for env_file in [os.path.join(userhome, ".grass.bashrc"),

.... a leftover?

Markus