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