[GRASS-user] Re: shell script

Paul Kelly paul-grass at stjohnspoint.co.uk
Mon Jun 28 05:51:41 EDT 2010


Sandile Gumede wrote:
> Hi
> 
> I'm trying to run the script below but it's giving me an error saying 
> default region is not set.
> 
> Which command should I use to set the default region and do I put it?
> 
> #!/bin/sh
> 
> #variable to customize:
> # path to GRASS software main directory
> GISBASE=/usr/lib/grass64
> # path to GRASS database
> GISDBASE=$HOME/grassdem
> 
> # nothing to change below
> MAP=$1
> LOCATION=$2
> 
> 
> # generate temporal LOCATION:
> TEMPDIR=FLOODS
> mkdir -p $GISDBASE/$TEMPDIR/PERMANENT
> 
> # save existing $HOME/.grassrc6
> if test -e $HOME/.grassrc6 ; then
> mv $HOME/.grassrc6 /tmp/$TEMPDIR.grassrc6
> fi
> 
> echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
> echo "MAPSET:PERMANENT"             >> $HOME/.grassrc6
> echo "DIGITIZER: none"        >> $HOME/.grassrc6
> echo "GISDBASE: $GISDBASE"    >> $HOME/.grassrc6
> export GISBASE=$GISBASE
> 
> # Create a WIND file with minimal information and no projection:
> echo "proj:       0
> zone:       0
> north:      1
> south:      0
> east:       1
> west:       0
> cols:       1
> rows:       1
> e-w resol:  1
> n-s resol:  1
> top:        1
> bottom:     0
>  cols3:      1
> rows3:      1
> depths:     1
> e-w resol3: 1
> n-s resol3: 1
> t-b resol:  1
> " > $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND
>  
> # Copy WIND-file to DEFAULT_WIND:
> cp $TEMPDIR/$LOCATION_NAME/$MAPSET/WIND \
>  $TEMPDIR/$LOCATION_NAME/$MAPSET/DEFAULT_WIND


Where are the variables $LOCATION_NAME and $MAPSET being set? As far as 
I can see they seem to be empty - could that be the problem?

Paul



More information about the grass-user mailing list