[GRASSLIST:5866] Re: very short script help
Daniel Victoria
daniel.victoria at gmail.com
Mon Feb 21 12:06:11 EST 2005
Hi,
The problem is probably in the expression. As far as I know, expr
won't work with floaing point so in this case, you'll have to use bc.
On my system, the command would be:
echo "3.3/1" | bc - l
the -l (lowercase L) swith is to use standard math librarie, but it
then uses around 10 decimal places....
In your case, you'd replace 1 with $i
Cheers
Daniel
On Mon, 21 Feb 2005 12:12:00 +0100, javier garcia <rn001 at cebas.csic.es> wrote:
> Please, I don't have any idea of bash and I'm trying to do a very short script
> to alter the region for a set of descending resolutions, but I must be doing
> someting wrong:
>
> --------------
> #!/bin/sh
>
> i=33
> while [ $i -ge 1 ]
> do
> resol= `expr 3.3 / $i`
> g.region n=9.9 s=0 e=3.3 w=0 res=$resol
> echo "resolution is $resol"
> i=`expr $i - 1`
> done
> --------------
>
> Please, could you help with this?
>
> Best regards,
>
> Javier
>
>
More information about the grass-user
mailing list