On 07/07/2025 at 07:02, Bernhard Voelker wrote:
On 7/6/25 13:11, Stefan Klinger wrote:
I've implemented a small tool [1] to test whether a directory is
empty, and I think it would make a useful addition to GNU coreutils.
IMHO, the number of tools required to implement such a simple test
shoul
On 7/6/25 13:11, Stefan Klinger wrote:
I've implemented a small tool [1] to test whether a directory is
empty, and I think it would make a useful addition to GNU coreutils.
IMHO, the number of tools required to implement such a simple test
should be 1, [...]
This "dir is empty" information i
Rob Landley writes:
> Do you also need a specific tool to check if a file is zero length?
> Because "touch file; [ -f file -a 0 -eq "$(stat -c%s file)" ] && echo
> boom" is a similar level of complexity, since merely going stat -c%s
> file doesn't prove that file exits and isn't a directory...
t
On 7/6/25 06:11, Stefan Klinger wrote:
Hello,
I've implemented a small tool [1] to test whether a directory is
empty, and I think it would make a useful addition to GNU coreutils.
mkdir sub
[ -d sub -a -z "$(ls -A sub)" ] && echo boom
Is it a directory, is it empty.
(Admittedly I didn't chec
Hello Pádraig,
and thanks for your kind and swift reply!
Pádraig Brady (2025-Jul-06, excerpt):
> Anyway I don't think a separate utility is warranted for this
> functionality.
Fair enough, I'm only *very mildly* disappointed =)
> I agree with the thread at [2] that `test -F` may be the best
> i
On Sun, Jul 06, 2025 at 01:11:30PM +0200, Stefan Klinger wrote:
> Some solutions are more compact and use only shell builtins, e.g.,
>
> $ if ! (shopt -s failglob dotglob; : *) 2>/dev/null; then
> echo is empty
> fi
>
> but this may not port nicely to other shells (and has so
On 06/07/2025 12:11, Stefan Klinger wrote:
Hello,
I've implemented a small tool [1] to test whether a directory is
empty, and I think it would make a useful addition to GNU coreutils.
There once was a discussion [2] on this mailing list, proposing the
extension of `test` with a `-E` flag. AFAI
Hello,
I've implemented a small tool [1] to test whether a directory is
empty, and I think it would make a useful addition to GNU coreutils.
There once was a discussion [2] on this mailing list, proposing the
extension of `test` with a `-E` flag. AFAICT this led nowhere,
although the topic does