r.mapcalc script and pipes
Bob Courtney
courtney at agcrr.bio.ns.ca
Tue Jul 20 09:03:06 EDT 1993
>
> If I type
> set ima = vegetation1
> r.mapcalc res = $ima * $ima
>
> r.mapcalc works without problems, but if I type
> r.mapcalc < test
>
> where test is a file whose only line is:
> res = $ima * $ ima
>
> then r.mapcalc says <$ima> not found, that is, it does not interpret
> $ima as the value of ima. If I write test as,
> 'res = ' $ima '*' $ima
>
> then r.mapcalc gets confused and me too.
>
> I have to use this piping because r.mapcalc is within a loop in an
> script, ima takes different values and the expression actually passed
> to r.mapcalc is complex.
> Is there any way to get r.mapcalc to interpret $ima when piped?
>
> Thamks,
> Agus
>
Try :
r.mapcalc <<EOI
res = $ima * $ima
EOI
or
r.mapcalc "res = $ima * $ima "
Both forms should work.
Bob Courtney
Atlantic Geoscience Center
More information about the grass-user
mailing list