[GRASS-user] Batch Processing in GRASS 6.2 w/ Cygwin

Steve Hanser shanser at usgs.gov
Wed Aug 8 12:08:31 EDT 2007


I am trying to write a batch file for Cygwin that will run multiple GRASS 
r.le.pixel commands, change the region, and rerun commands on the new 
region.  I have a simplified version based on a previous posting to this 
listserv.  I have tried using it under #!/bin/sh and #!/bin/ash and 
receive error with both.  Please help.  Thank you.

Under #!/bin/sh  -  Does not produce the testing.txt file

$ ./batch-grass6v3.sh
: No such file or directory4: testing.txt
: No such file or directory5: testing.txt
: No such file or directory6: testing.txt
': not a valid identifier 21: export: `GISBASE
': not a valid identifier 22: export: `GISRC
./batch-grass6v3.sh: line 25: $'g.version\r': command not found
/etc/clean_temp: No such file or directoryrass-6.2.2

Under #!/bin/ash

Produces the testing.txt file but nothing else.

$ ./batch-grass6v3.sh
export: Files/ATI: bad variable name
g.version: not found

Here is the current version of the script:

#!/bin/sh
# Customize this:
#------------------------------------------------------------------------------
# Nothing to change below (I think)
#==============================================================================
# Usage Message
#
GISRC="~/testing.txt"
GISDBASE="/cygdrive/c/Data/WBEA"
GISBASE="/usr/local/grass-6.2.2"
# generate GRASS settings file:
#------------------------------------------------------------------------------
# the file contains the GRASS variables which define the LOCATION etc.
echo $GISDBASE > testing.txt
echo "LOCATION_NAME: newset" >> testing.txt
echo "MAPSET: C1" >> testing.txt
#------------------------------------------------------------------------------
# exports
#------------------------------------------------------------------------------
export LOCATION_NAME=newset
export GISBASE
export GISRC
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
export GIS_LOCK=$$                                       # use PID as lock 
file number
g.version
# Cleanup and Exit 
#------------------------------------------------------------------------------
$GISBASE/etc/clean_temp                                     # GRASS' 
cleanup routine
rm -rf /cygdrive/c/cygwin/tmp/grass6-$USER-$GIS_LOCK        # remove 
session tmp directory
rm -f $GISRC


Steve Hanser
Wildlife Biologist / GIS Specialist
USGS, FRESC, Snake River Field Station
970 Lusk St. Boise, ID 83706
PH: 208-426-2892 FAX: 208-426-5210
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20070808/0a75a7a5/attachment.html


More information about the grass-user mailing list