tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkgsrc littering the home directory



On Tue, 05 Feb 2008 17:55:09 +0700
Robert Elz <kre%munnari.OZ.AU@localhost> wrote:

>     Date:        Tue, 5 Feb 2008 09:56:31 +0100
>     From:        Tobias Nygren <tnn%NetBSD.org@localhost>
>     Message-ID:  <20080205095631.22751dc1.tnn%NetBSD.org@localhost>
> 
>   | This is the solution I'll go with (large number of files are not
>   | expected):
> 
> I'd have thought awk a little heavyweight, compared to sed,
> but if you're going to use it, then:
> 
>   | ls -a foo | \
>   | awk '{if (!($0=="." || $0=="..")) cnt++} END {print cnt?1:0}'
> 
> why not:
> 
>       awk '{ if ($0 != "." && $0 != "..") {X=1; exit}} END {print X + 0}'
> 
> which also (when piped output from ls -a of course) shuts down
> quickly (as soon as it finds a file, other than . or ..).

I noticed the De Morgan simplification (already committed).
Thanks for the other suggestion though, I'll use that.



Home | Main Index | Thread Index | Old Index