<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">Under #!/bin/sh - Does not
produce the testing.txt file</font>
<br>
<br><font size=2 face="sans-serif">$ ./batch-grass6v3.sh</font>
<br><font size=2 face="sans-serif">: No such file or directory4: testing.txt</font>
<br><font size=2 face="sans-serif">: No such file or directory5: testing.txt</font>
<br><font size=2 face="sans-serif">: No such file or directory6: testing.txt</font>
<br><font size=2 face="sans-serif">': not a valid identifier 21: export:
`GISBASE</font>
<br><font size=2 face="sans-serif">': not a valid identifier 22: export:
`GISRC</font>
<br><font size=2 face="sans-serif">./batch-grass6v3.sh: line 25: $'g.version\r':
command not found</font>
<br><font size=2 face="sans-serif">/etc/clean_temp: No such file or directoryrass-6.2.2</font>
<br>
<br><font size=2 face="sans-serif">Under #!/bin/ash</font>
<br>
<br><font size=2 face="sans-serif">Produces the testing.txt file but nothing
else.</font>
<br>
<br><font size=2 face="sans-serif">$ ./batch-grass6v3.sh</font>
<br><font size=2 face="sans-serif">export: Files/ATI: bad variable name</font>
<br><font size=2 face="sans-serif">g.version: not found</font>
<br>
<br><font size=2 face="sans-serif">Here is the current version of the script:</font>
<br>
<br><font size=2 face="sans-serif">#!/bin/sh</font>
<br><font size=2 face="sans-serif"># Customize this:</font>
<br><font size=2 face="sans-serif">#------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif"># Nothing to change below (I think)</font>
<br><font size=2 face="sans-serif">#==============================================================================</font>
<br><font size=2 face="sans-serif"># Usage Message</font>
<br><font size=2 face="sans-serif">#</font>
<br><font size=2 face="sans-serif">GISRC="~/testing.txt"</font>
<br><font size=2 face="sans-serif">GISDBASE="/cygdrive/c/Data/WBEA"</font>
<br><font size=2 face="sans-serif">GISBASE="/usr/local/grass-6.2.2"</font>
<br><font size=2 face="sans-serif"># generate GRASS settings file:</font>
<br><font size=2 face="sans-serif">#------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif"># the file contains the GRASS variables
which define the LOCATION etc.</font>
<br><font size=2 face="sans-serif">echo $GISDBASE > testing.txt</font>
<br><font size=2 face="sans-serif">echo "LOCATION_NAME: newset"
>> testing.txt</font>
<br><font size=2 face="sans-serif">echo "MAPSET: C1" >>
testing.txt</font>
<br><font size=2 face="sans-serif">#------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif"># exports</font>
<br><font size=2 face="sans-serif">#------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif">export LOCATION_NAME=newset</font>
<br><font size=2 face="sans-serif">export GISBASE</font>
<br><font size=2 face="sans-serif">export GISRC</font>
<br><font size=2 face="sans-serif">export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts</font>
<br><font size=2 face="sans-serif">export GIS_LOCK=$$
# use PID as lock file
number</font>
<br><font size=2 face="sans-serif">g.version</font>
<br><font size=2 face="sans-serif"># Cleanup and Exit </font>
<br><font size=2 face="sans-serif">#------------------------------------------------------------------------------</font>
<br><font size=2 face="sans-serif">$GISBASE/etc/clean_temp
# GRASS' cleanup
routine</font>
<br><font size=2 face="sans-serif">rm -rf /cygdrive/c/cygwin/tmp/grass6-$USER-$GIS_LOCK
# remove session tmp directory</font>
<br><font size=2 face="sans-serif">rm -f $GISRC</font>
<br>
<br>
<br><font size=2 face="sans-serif">Steve Hanser<br>
Wildlife Biologist / GIS Specialist<br>
USGS, FRESC, Snake River Field Station<br>
970 Lusk St. Boise, ID 83706<br>
PH: 208-426-2892 FAX: 208-426-5210</font>