[GRASS-dev] how to deal with the @mapset in scripts?

Glynn Clements glynn at gclements.plus.com
Wed Jul 4 07:56:15 EDT 2007


Hamish wrote:

> > the @mapset is not a problem when the maps are used by some command,
> > like r.mapcalc, bu it is a problem because the default output map (if
> > you don't give a name) will be based on the input, like:
> > input : in_map
> > output : in_map_roughness_3x3
> > 
> > so I need to get rid of the @mapset, or else it will be set to
> > 
> > in_map at mapset_roughness_3x3
> > 
> > and r.mapcalc will fail.
> 
> OUTMAP="`echo "$INMAP" | cut -f1 -d'@'`_roughness_3x3"

	OUTMAP="${INMAP%%@*}_roughness_3x3"

The ${var%%pattern} syntax should be portable, according to:

http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02

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




More information about the grass-dev mailing list