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

Carlos "Guâno" Grohmann carlos.grohmann at gmail.com
Tue Jul 3 09:42:02 EDT 2007


I just copied the stuff from r.shaded.relief..



On 7/3/07, Glynn Clements <glynn at gclements.plus.com> wrote:
>
> "Carlos \"Guâno\" Grohmann" wrote:
>
> > I went look in r.shade.relief, so I changed
> >
> > if [ -z `g.findfile elem=cell file="$GIS_OPT_SLOPE" | grep ^file | cut
> > -f2 -d=` ] ; then
> >     g.message -e "<$GIS_OPT_SLOPE> does not exist! Aborting."
> >     exit 1
> > fi
> >
> > by
> > slope=$GIS_OPT_SLOPE
> >
> > eval `g.findfile element=cell file=$slope`
> > if [ -z "$name" ] ; then
> >    g.message -e  "Map <$slope> not found! Aborting."
> >    exit 1
> > fi
> >
> > and now it works fine.
>
> Why do you actually need to use g.findfile? In most cases, you should
> just pass the map name directly to the command, and let the command
> handle the checking.
>
> Also, if you use g.parser and the options have the appropriate
> "gisprompt" setting, g.parser will perform the relevant checks, so
> there's no need to repeat them.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>


-- 
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke




More information about the grass-dev mailing list