[GRASS-dev] [grass-code I][502] Grass 6.3 fails to apply database connection changes via db.connect

Hamish hamish_nospam at yahoo.com
Fri Oct 5 22:56:29 EDT 2007

Moritz Lennert wrote:
> > But I don't see any conditioning around this, so IIUC driver and 
> > database will always be set to dbf of the mapset at each startup. It 
> > probably needs a test for the dbf directory around it. Something like 
> > (not a bash expert):
> if [ ! -e  $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/];
>     then
>     mkdir "$LOCATION"/dbf
> fi
> And $LOCATION/VAR variables should only be preset to the dbf driver if 
> for any reason it is empty, if at all.

* you need a space before the closing "]" in the if statement
* you need to "quote" variable paths, they may have a space in them
* test if it's a dir, not a file (in unix everything is a file)

so the above would look like

if [ ! -d  "$LOCATION/dbf" ] ; then
    mkdir "$LOCATION"/dbf

But I'm really not sure that we do need to automatically make dbf/ dirs for
each new mapset, or even create a VAR file in the mapset before it is needed.
The user may never use the DBF driver, or for that matter any database if they
just stick to raster maps.

As usual, it's better to fix the bug at the source and strictly follow good
design principals as opposed to debating work-arounds.


Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.

More information about the grass-dev mailing list