[GRASSLIST:283] RE: r.mapcalc puzzler
H Bowman
hamish_nospam at yahoo.com
Tue Jun 3 21:34:08 EDT 2003
> > Don't you need quotes around a complicated expression like that?
> > I've always used %> r.mapcalc "a=sin(b)+cos(c)" so that the special
> > characters don't throw the shell into a tizzy.
Not if it is within a << EOF .. EOF; it treats whatever's inside as if
it were a file on the disk. Using ""s are necessary to protect the () *
etc from being interpreted as part of the command, ''s are even more
restrictive and stop $SHELL_VARIABLES from being expanded.
I think my problem was cutting and pasting between a Debian xterm and a
RedHat9 one. Redhat's gone and changed all their language encoding
around, and I think ASCII tabs get interpreted as special characters in
whatever Unicode system they now use..??
>
> which includes the following mapcalc magic to do a better r.grow:
>
> r.mapcalc << EOF
> grown = if( $src, $src, \\
> if($src[0,-1], $src[0,-1], \\
> if( $src[0,1], $src[0,1], \\
> if($src[-1,0], $src[-1,0], \\
> if( $src[1,0], $src[1,0] \\
> )))))
> EOF
More information about the grass-user
mailing list