<div dir="ltr"><div>Mine looks like this (bash shell):</div><div><br></div><div>grass_ps(){</div><div>        echo "G `g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`"</div><div>}</div><div>export PS1="\[\033]0;\$(grass_ps) \w\007\]\$(grass_ps) \w> "<br></div><div><br></div><div>The prompt gets updated dynamically since grass_ps() is called every time you hit enter.</div><div><br></div><div>Huidae</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 15, 2014 at 6:15 AM, Nikos Alexandris <span dir="ltr"><<a href="mailto:nik@nikosalexandris.net" target="_blank">nik@nikosalexandris.net</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 15.12.2014 12:33, Michel Wortmann wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Nikos, Hamish and list,<br>
you guys played around with your commandline prompts last year (see<br>
below), I was just implementing the same thing into my ~/.grass.bashrc<br>
(GRASS 7.0.0b3) but found that the location and mapset arent actually<br>
changed when changing them with g.mapset, i.e. .grass.bashrc isnt<br>
actually executed again.<br>
Whats the best way getting that to work with or without changing<br>
source or $GISBASE files?<br>
</blockquote>
<br></span>
Hi Michel!  How nice that someone else is doing this as well :-).  I don't think I changed much since -- here is my current setup:<br>
<br>
--%<---<span class=""><br>
SHORT_VER=`echo "$GRASS_VERSION" | cut -f1,2 -d. | sed -e 's/\.//'`<br></span>
GDBASE=`g.gisenv get=GISDBASE | rev | cut -d"/" -f1 | rev`<span class=""><br>
GLOCATION=`g.gisenv get="LOCATION_NAME"`<br>
GMAPSET=`g.gisenv get="MAPSET"`<br></span>
export PROMPT_DIRTRIM=2<br>
# export PS1='\e[32;40mG$SHORT_VER\e[0m [\e[34;40m${GLOCATION}\e[0m / \e[32;40m${GMAPSET}\e[0m] :\e[36;40m\w \e[0m[\#/\!] \n\r\e[32;40m>\e[0m '<br>
export PS1='\[\e[32m\]G$SHORT_VER\[\<u></u>e[0m\] [ ${GDBASE} / \[\e[33m\]${GLOCATION}\[\e[0m\<u></u>] @\[\e[32;1m\]${GMAPSET}\[\e[<u></u>0m\] ] : \[\e[36m\]\w \[\e[0m\][\#/\!]<br>
\[\e[32;1m\]>\[\e[0m\] '<br>
--->%--<br>
<br>
and, you are right, the Mapset isn't updated.  The Location, me thinks, should not change, or should only in special cases.  We don't usually switch Location's from inside a grass session. We do switch Mapsets.  But we should be careful because we need to manually instruct the use of the "new" history log once changed to another Mapset ("history -w; history -r" etc). Right?<br>
<br>
Otherwise, I came with a stupid solution, a function inside "grass.bashrc" to re-source itself:<br>
<br>
--%<---<br>
# Re-Source Me!<br>
g.src()<br>
{<br>
  source ~/.grass.bashrc<br>
}<br>
--->%--<br>
<br>
I tested it and it works. Change a mapset and then `g.src` or whatever you might name it.  Don't know if it's dangerous though.<br>
<br>
Let us know if you come up with something smart.  I would love to see a zsh like behaviour inside grass shell.  Would be awesome.<br>
<br>
Nikos<br>
<br>
______________________________<u></u>_________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/grass-dev</a><br>
</blockquote></div></div>