[GRASS-user] bash script

Sandile Gumede akasandile at gmail.com
Thu Jun 24 02:31:21 EDT 2010


Hi

I'm trying to run GRASS and import raster map using a bash script but I'm
getting an error saying r.in.gdal not found.

What have I done wrong? see the script below.

#!/bin/sh

#variable to customize:
# path to GRASS software main directory
GISBASE=/usr/bin/grass64
# path to GRASS database
GISDBASE=$HOME/grassdem

GISBASELIB=/usr/lib/grass64

# nothing to change below
MAP=SRTMDEM.tiff
LOCATION=/home/tgumede1/
grassdem


# generate temporal LOCATION:
TEMPDIR=Floods
mkdir -p $GISDBASE/$TEMPDIR/tmp

# save existing $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi

echo "LOCATION_NAME: $TEMPDIR" > $HOME/.grassrc6
echo "MAPSET:tmp" >> $HOME/.grassrc6
echo "DIGITIZER: none" >> $HOME/.grassrc6
echo "GISDBASE: $GISDBASE" >> $HOME/.grassrc6
export GISBASE=$GISBASE

# first our GRASS, then the rest
export PATH=$GISBASE:$GISBASELIB/scripts:$PATH

# first have our private libraries:
export LD_LIBRARY_PATH=$GISDBASE/lib:$GISBASELIB/lib:$LD_LIBRARY_PATH

# import raster map into new location:
r.in.gdal -eo in=$MAP out=dem location=$LOCATION
if [$? -eq 1] ; then
echo "An error occured. Stop."
exit 1
fi

# restore saved $HOME/.grassrc6
if test -e $HOME/.grassrc6 ; then
mv $HOME/.grassrc6 /$GISDBASE/$TEMPDIR.grassrc6
fi



-- 
Kind Regards
TS Gumede
CSIR, Meraka Institute
072 258 1650
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100624/3ea61d3b/attachment-0001.html


More information about the grass-user mailing list