[GRASSweb-list]markus: web/faq batch-grass.sh,NONE,1.1

grass at intevation.de grass at intevation.de
Thu Jun 27 09:29:14 EDT 2002


Author: markus

Update of /grassrepository/web/faq
In directory doto:/tmp/cvs-serv11803

Added Files:
	batch-grass.sh 
Log Message:
added with fix

--- NEW FILE: batch-grass.sh ---
#!/bin/sh
#Author: Andrew E Long 
#        aelon at sph.umich.edu
# ael, Mon Nov 16 08:54:15 EST 1998
# update by A. Prasad 20. Jan. 2000
#           aprasad/ne_de at fs.fed.us
# $Date: 2002/06/27 13:29:12 $

### Installation: Just edit paths for GISBASE, GISDBASE and GISRC
#customize this:
GISDBASE=/home/user/grassdata
GISBASE=/usr/local/grass5
GISRC=$GISDBASE/../.grassrc5

############ nothing to change below (I think)

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


ETC=$GISBASE/etc
PATH=$GISBASE/bin:$GISBASE/scripts:$GISBASE/garden/bin:$PATH:/usr/bin
cat << EOF > $GISRC
GISDBASE: $GISDBASE
LOCATION_NAME: $1
MAPSET: $2
PAINTER: ppm
MAPLP: stuff.ppm
EOF

export GISBASE GISDBASE ETC PATH GISRC
export LOCATION_NAME=$1                                                         
export MAPSET=$2                                                                
export LOCATION=${GISDBASE?}/${LOCATION_NAME?}/${MAPSET?}

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-web mailing list