[GRASS-dev] Custom GRASS command line prompt

Hamish hamish_b at yahoo.com
Sat Jul 27 19:50:10 PDT 2013


Nikos:
> I want to alter the default GRASS command line prompt. For my needs,
> I find it better to have the current Mapset shown along with the
> Location.
> 
> As a first experiment, I edited the corresponding file in place:
> grass7_trunk/dist.x86_64-unknown-linux-gnu/grass70.tmp, line 1039:
> 
> - f.write("PS1='GRASS %s (%s):\w > '\n" % (grass_version, location_name))
> + f.write("PS1='G %s (%s/%s):\w > '\n" % (grass_version, location_name, mapset))
>
> Now it appears like:  "G 7.0.svn (utm_37s/post):~ >".  My understanding is
> that I probably need to edit the file:
> grass7_trunk/dist.x86_64-unknown-linux-gnu/grass70.tmp
> 
> Do you have customised prompts?  Any ideas for a more productive
> command line?

I'd suggest to put the change in ~/.grass.bashrc instead.


fwiw here's what I have there wrt the prompt:

SHORT_VER=`echo "$GRASS_VERSION" | cut -f1,2 -d. | sed -e 's/\.//'`
export PS1='G$SHORT_VER:\W > '
export HISTSIZE=3000

.or.

export PS1='G$SHORT_VER:\w > '
export PROMPT_DIRTRIM=2

as full dir path gets much too long, especially on WinGrass where the
terminal width is a pain to resize.


For simplicity one of my favourites is still just:

export PS1='GRASS$SHORT_VER> '


If you do most of your work with a small set of locations, it might
also be an idea to figure something out with Xresources to color the
terminal background based on which one you're running in.


regards,
Hamish



More information about the grass-dev mailing list