non-interactive start

Andrew E Long aelon at sph.umich.edu
Mon Dec 13 15:00:40 EST 1999


Hi Karin,
	I see that Michel answered your question, but I thought that I'd
attach my "batch-grass" shell script. I think that you'll only need to
change one line in this file:

GISBASE=/data/grass/ftp/src421

to whatever your GISBASE is.

	Hope this helps. Get back with any questions.
Andy


On Wed, 24 Nov 1999, Karin Mayer wrote:

> hallo GRASS community
> 
> Is there a possibility to start GRASS with existing loacations and 
> mapsets non-interactivly by shell-scripts?
> 
> Thanks for giving some ideas.
> Karin
> 

-------------- next part --------------
#!/bin/sh

#ael, Mon Nov 16 08:54:15 EST 1998
if test $# -eq 0
then
    cat <<EOF

			    batch-grass usage:

    batch-grass runs a command (or executes all commands in a file) in the
grass environment. It simply sets some environmental variables and executes
the commands.

	batch-grass location_name mapset command
	batch-grass location_name mapset -file filename

e.g.,

	batch-grass usgs PERMANENT -file make-quads

EOF
	exit 0
fi

GISBASE=/data/grass/ftp/src421
GISDBASE=$GISBASE/data
ETC=$GISBASE/etc;
PATH=$GISBASE/bin:$GISBASE/scripts:$GISBASE/garden/bin:$PATH:/usr/bin
GISRC=/data/tmp/.grassrc.$$
cat << EOF > $GISRC
GISDBASE: $GISDBASE
LOCATION_NAME: $1
MAPSET: $2
PAINTER: ppm
MAPLP: stuff.ppm
EOF

export GISBASE GISDBASE ETC PATH GISRC

if test "$3" = "-file"
then
    cat $4 | sh
else
    # strip off the location and mapset,
    shift 2
    # then execute the command which remains:
    $*
fi

/bin/rm -f $GISRC
exit 1


More information about the grass-user mailing list