<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" bgcolor="#FFFFFF"
    text="#000000">
    <div class="moz-cite-prefix">On 04/03/2014 11:31 AM, rajatrn wrote:<br>
    </div>
    <blockquote cite="mid:1396513874064-5132797.post@n6.nabble.com"
      type="cite">
      <pre wrap="">Hi,
I have two layer lists, NDVIFILES and VIQALIST, both developed using g.mlist
command in GRASS.
Each file has 22 items in it. I would like to perform a simple raster
calculation of the following form,
Mask$NDVIFILES [i] = NDVIFILES[i] * VIQALIST[i]
I'm unable to create a loop which can sequentially produce the required
outputs.
I will be grateful if anyone can help me with creating a loop using
bash/shell script.
I know it is simpler to do it in R but will be great if can be implemented
on using grass terminal/shell.
Thank you in advance,
Sincerely,
Rajat
</pre>
    </blockquote>
    <br>
    Maybe something along these lines (not tested):<br>
    <br>
    for i in `seq 1 22`; do \<br>
        NDVI=`sed -n "${i}p" NDVIFILES` ;<br>
        VIQA=`sed -n "${i}p" VIQALIST` ;<br>
        NEW=Mask${NDVI} ;<br>
        echo "Creating ${NEW};<br>
        r.mapcalc " $NEW = $NDVI * $VIQA ";<br>
    done<br>
    <br>
    <br>
    <blockquote cite="mid:1396513874064-5132797.post@n6.nabble.com"
      type="cite">
      <pre wrap="">


--
View this message in context: <a class="moz-txt-link-freetext" href="http://osgeo-org.1560.x6.nabble.com/looping-r-mapcalc-in-a-shell-script-tp5132797.html">http://osgeo-org.1560.x6.nabble.com/looping-r-mapcalc-in-a-shell-script-tp5132797.html</a>
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>

This mail was received via Mail-SeCure System.


</pre>
    </blockquote>
    <br>
  </body>
</html>