[GRASS-dev] r.distance: 'maps=map1, map2' vs 'maps=map1 maps=map2'

Glynn Clements glynn at gclements.plus.com
Sat Nov 13 00:04:46 EST 2010


Maciej Sieczka wrote:

> I have discovered an undocumented feature (?) in r.distance.
> 
> The manual reads:
> 
> r.distance maps=map1,map2
> 
> When I specify it as:
> 
> r.distance maps=map1 maps=map2
> 
> it works as well.

This is a feature of the parser, and works for all modules.

> The order can also be controlled this way. I.e.:
> 
> r.distance maps=map1,map2 is equivalent to r.distance maps=map1 maps=map2
> 
> and:
> 
> r.distance maps=map2,map1 is equivalent to r.distance maps=map2 maps=map1
> 
> Can I rely on this behavior or may it change in future? Currently it 
> works for 6.4 svn and 7 svn.

It isn't expected to change. It's useful for constructing argument
lists using xargs, e.g.:

	... | sed 's/^/map=/' | xargs g.something ...

This is much harder to achieve using the opt=val,val,val,... syntax.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list