[GRASS5] cd $LOCATION revisited

There is probably some confusion concerning $LOCATION variable:

[...]
Writing Helena (GRASS 5.3-CVS):

> > if I work in GRASS on command line and I type
> >
> > GRASS:~ > cd $GISDBASE/$LOCATION_NAME/$MAPSET
> > GRASS:~/grassdata/wake-spft/helena > pwd
> > /home/helena/grassdata/wake-spft/helena
> > GRASS:~/grassdata/wake-spft/helena > ls
> > cats cell cellhd cell_misc colr dig dig_att dig_cats dig_plus
> > fcell g3dcell hist WIND

Answer Markus (GRASS 5.3-CVS):

> On a standard version it doesn't work:
>
> GRASS:~ > cd $GISDBASE/$LOCATION_NAME/$MAPSET
> GRASS:// >

... confusing!

Clarification (desired behaviour?):

I don't have any trick or modification - Jaro has explained it to me -
when you start GRASS with tcltk interface the variables get set up and
it works as written above.
If you start with -text then I get what you have described
as standard version. So far on the machines where I have tried it
it works like this without any tricks

Helena

For me it's strange if, depending how GRASS was started, $LOCATION
is set or not. Guess that this should be fixed.

Markus

Markus Neteler wrote:

> I don't have any trick or modification - Jaro has explained it to me -
> when you start GRASS with tcltk interface the variables get set up and
> it works as written above.
> If you start with -text then I get what you have described
> as standard version. So far on the machines where I have tried it
> it works like this without any tricks

For me it's strange if, depending how GRASS was started, $LOCATION
is set or not. Guess that this should be fixed.

That behaviour is due to the following in gis_set.tcl:

    button .frame0.frameBUTTONS.ok \
       -text [G_msg "Use Selection"] \
      -relief raised \
       -padx 10 \
       -command {
            if { $mapset != "" } {
              CheckLocation
                puts stdout "GISDBASE='$database'; export GISDBASE;"
                puts stdout "LOCATION_NAME='$location'; export LOCATION_NAME;"
                puts stdout "MAPSET='$mapset'; export MAPSET;"
                if {[string compare $location "##ERROR##"] != 0} {
        putGRASSRC $gisrc_name
    }
    destroy .
            }
        }

    button .frame0.frameBUTTONS.newLoc \
      -text [G_msg "Create New Location"] \
      -relief raised \
      -padx 10 \
      -command {
            puts stdout "OLD_DB='$oldDb';"
            puts stdout "OLD_LOC='$oldLoc';"
            puts stdout "OLD_MAP='$oldMap';"
      puts stdout "GISDBASE='$database'; export GISDBASE;"
          puts stdout "LOCATION_NAME='##NONE##'; export LOCATION_NAME;"
            puts stdout "MAPSET=''; export MAPSET;"
            set location ""
      set mapset ""
      putGRASSRC $gisrc_name
      destroy .
        }

The "export" commands shouldn't be there.

--
Glynn Clements <glynn.clements@virgin.net>