[GRASS-dev] g.mremove bug?

Glynn Clements glynn at gclements.plus.com
Fri Feb 22 22:04:31 EST 2008


Ivan Shmakov wrote:

>  > The more fundamental problem with using xargs is that the GRASS
>  > parser requires multiple "answers" for any given option to be
>  > separated by commas, not spaces.
> 
> 	Does it?  IIUC, the following commands are completely equivalent
> 	as long as the GRASS parser is concerned:
> 
> $ g.remove rast=foo,bar 
> 
> $ g.remove rast=foo rast=bar 

Right; I was thinking specifically about the former case. It's so long
since I've seen the latter form used that I had forgotten about it.

The former case may be slightly more efficient (you'll get more maps
into a maxium-length command line), but it's probably not worth the
additional effort.

>  > That effectively requires g.mremove to collate names itself.
> 
>  > Invoking g.remove once per map is simpler, but it's also inefficient.
> 
> 	Huh?  Even simpler than the following?

Yes.

Generating shell commands using sed then executing them is anything
but simple; particularly when the sed command is itself generated
using shell features (variable substitution).

"while read map ; do g.remove ... ; done" may be more verbose, but
it's much easier to understand.

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


More information about the grass-dev mailing list