[GRASS-user] g.mlist newline separator request

Martin Landa landa.martin at gmail.com
Thu Apr 19 12:27:37 EDT 2007


Done.

2007/4/19, Patton, Eric <epatton at nrcan.gc.ca>:
> Well, as no one seems to have had an objection or comment, and I can confirm that it does indeed work, would it be possible for someone to commit Martin's patch to CVS?
>
> Thanks,
>
> ~ Eric.
>
>
> -----Original Message-----
> From: Martin Landa [mailto:landa.martin at gmail.com]
> Sent: Fri 4/13/2007 5:06 AM
> To: Patton, Eric
> Cc: grassuser at grass.itc.it
> Subject: Re: [GRASS-user] g.mlist newline separator request
>
> 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 *
>
>


-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *




More information about the grass-user mailing list