[GRASS-user] split adjacent categories

Daniel Victoria daniel.victoria at gmail.com
Thu Jan 10 14:20:28 EST 2008


Where was COUNTER not recognized? In the r.mapcalc program or in the while loop?

In bash, for you to define a variable you can't put spaces between the
variable and the equal sign

try COUNTER=1 and NOT COUNTER = 1


On Jan 10, 2008 5:12 PM, Martin Wegmann
<wegmann at biozentrum.uni-wuerzburg.de> wrote:
> On Donnerstag, 10. Januar 2008 20:00:16 Patton, Eric wrote:
> > >while [  $COUNTER < $max ]; do
> > >        echo The counter is $COUNTER
> > >
> > >     r.mapcalc "t1 = if(rast_in == $COUNTER,1,null())"
> > >     r.buffer input=t1 output=b.$COUNTER distance=500
> > >
> > >     let COUNTER=COUNTER+1
> > >
> > >   done
> > >
> > >but failed because COUNTER was not recognized and I don't know at all, if
> > >these bash statements work at all using GRASS.
> > >
> > >I welcome any other idea.
> >
> > Shouldn't your bash variables be quoted within the loop?
> >
> > while [ "$COUNTER" -lt "$MAX" ] ; do
> >
> > Similarly for the let statement:
> >
> > let "COUNTER=COUNTER+1"
>
> thanks - I added it but the first part:
>
> COUNTER = 1
>
> already caused
>
> COUNTER: command not found
>
> can this bash scripting be used in GRASS like that at all?
>
> Martin
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list