[GRASS-user] bash script error

Dear bash scripters,

I would like to create the following r.mapcalc command calling a map in a script in GRASS 6.4.1 (Ubuntu 10.4):

g.ask type=old prompt="enter DTM" elem=cell_misc unixfile=/home/becca/Documents/grassdata/scripts/settings
. /home/becca/Documents/grassdata/scripts/settings
if [ ! "$file" ]
then
exit
fi

MAP=${fullname}
BKG=${name}_bkg

r.mapcalc '${BKG} = if(isnull(modern_mask@Brovey),${MAP},0)'

but it ends with the error

Invalid map <${MAP}>

Can
anyone tell me how I should include calls to the map and name a
derivative using the original raster name? I have used this syntax with
success before so have not be able to troubleshoot this.

Thanks for reading,

Rebecca Bennett

Rebecca Bennett wrote:

r.mapcalc '${BKG} = if(isnull(modern_mask@Brovey),${MAP},0)'

but it ends with the error

Invalid map <${MAP}>

Can
anyone tell me how I should include calls to the map and name a
derivative using the original raster name? I have used this syntax with
success before so have not be able to troubleshoot this.

You need to use double quotes around the r.mapcalc expression.
Single-quoted strings take everything up to the next single quote
literally, while double-quoted strings expand variable substitutions.

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