On Wed, 6 Apr 2016 16:58:12 -0400
Michael Stone <[email protected]> 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
> ><[email protected]> 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,
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: pgpbU_T9mlhaY.pgp
Description: OpenPGP digital signature

Reply via email to