[GRASS-user] grass prompt default working directory

Hamish hamish_b at yahoo.com
Tue Feb 26 12:34:51 PST 2013


Hamish wrote:
> firstly, you can add this to ~/.grass.bashrc:
> 
> g.cd()
> {
>   MAPSET=`g.gisenv get=MAPSET`
>   LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
>   GISDBASE=`g.gisenv get=GISDBASE`
>   LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
>   cd "$LOCATION"
> }
> 
> (as I just did, nice idea, thanks!)

here is a slight modification so you can also do "g.cd colr/",
or even "g.cd .." to get to the LOCATION's dir:


g.cd()
{
  MAPSET=`g.gisenv get=MAPSET`
  LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
  GISDBASE=`g.gisenv get=GISDBASE`
  LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
  cd "$LOCATION/$1"
}


Hamish


More information about the grass-user mailing list