coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] test: Add unary operator -E: test that a file is an empty di


From: Mattias Andrée
Subject: Re: [PATCH] test: Add unary operator -E: test that a file is an empty directory
Date: Thu, 7 Apr 2016 00:04:54 +0200
User-agent: Claws Mail

On Wed, 6 Apr 2016 23:33:02 +0200
Mattias Andrée <address@hidden> wrote:

> On Wed, 6 Apr 2016 16:58:12 -0400
> Michael Stone <address@hidden> wrote:
> 
> > On Wed, Apr 06, 2016 at 10:36:50PM +0200, Mattias Andrée
> > wrote:  
> > >On Wed, 6 Apr 2016 16:23:23 -0400 Michael Stone
> > ><address@hidden> wrote:    
> > >> Just wondering, what's the use case?    
> > >
> > >I just don't want a separate tool for it,    
> > 
> > Well, that's not a particularly compelling use case,
> > especially since testing the output of ls -A seems
> > pretty straightforward.  
> 
> But what is likely is that people write sometime like
> 
>   test -d "$1" && test $(ls -1 "$1" | wc -l) = 0
> 
> Most people are of course going to miss to use --,
> but that is always the case and it is just an unimportant
> bonus that that does not matter with test.
> 
> Then we also have the problem that people will not
> consider that file may be a symlink ("$1/" is required.)
> 
> People will also forget hidden files.
> 
> But yes, you do not need it, just like you do not need
> head, echo, cut --complement, basename, dirname, pwd,
> seq, printenv that does not fail with exit value 2
> (well, you do need that one if you want to be portable,)
> suffixes and multiple arguments in sleep, touch, true,
> false, yes, link, unlink, rm -d, test -bcdefghLnpSstuz,

Missed test -k.

Sorry, I had to add this, it was disturbing my sleep.

> test -ne, test -ge, test -le, test -lt, test -ef,
> test !=, [. They can all be trivially implemented using
> other tools, with with a subset of the tool, with only
> marginal performance impact. but they are still nice to
> have.
> 
> > 
> > Mike Stone
> > 
> >   
> 

Attachment: pgpynpBGNxylg.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]