tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkgsrc littering the home directory
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 ..).
kre
Home |
Main Index |
Thread Index |
Old Index