[GRASS-user] g.mlist newline separator request

Martin Landa landa.martin at gmail.com
Fri Apr 13 04:06:38 EDT 2007


Hi,

this patch should fix it.

But I am not sure whether to commit it to CVS. Patch seems to be
"ugly" for me, moreover I am not sure why printf fn was used in the
script (?)

Martin

2007/4/12, Patton, Eric <epatton at nrcan.gc.ca>:
> I've noticed that g.mlist doesn't enter a newline after the last entry in a list, which used to be the case about a month ago:
>
> ~/coderepo >g.mlist pattern=Minas_Basin*
> Minas_Basin_Jan16_2007_50m
> Minas_Basin_Jan16_2007_50m_med3
> Minas_Basin_Jan16_2007_50m_med3_shade
> Minas_Basin_Jan16_2007_50m_med3_shade_comb
> Minas_Basin_Jan16_2007_50m_shade
> Minas_Basin_Jan16_2007_50m_shade_comb~/coderepo >
>
> Consequently, any script that tries to get a count from g.mlist by piping to wc will get an incorrect count that will be off by one:
>
>
> g.mlist pattern=Minas_Basin_Jan16_2007_50m | wc -l
> 0 (Should be 1)
>
> g.mlist pattern=Minas_Basin* | wc -l
> 5 (Should be 6)
>
> Would it be possible to get the final newline back? I have scripts that are broken now because a for loop never gets started when a check is done against the number of rasters matched:
>
> MATCHES=`g.mlist pattern=${PATTERN} | wc -l`
>
> # Abort if no matches are found.
> if [ "$MATCHES" -eq 0 ] ; then
>         echo "$SCRIPT: No rasters matched the search pattern!"
>         exit 1
> fi
>
>
> ~ Eric.
>
> _______________________________________________
> grassuser mailing list
> grassuser at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grassuser
>


-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: g.mlist.diff
Type: application/octet-stream
Size: 1897 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20070413/c59643bf/g.mlist.obj


More information about the grass-user mailing list