GNU bug report logs - #69261
'ls' : --ignore does not apply on FILEs selection

Previous Next

Package: coreutils;

Reported by: Mathias MICHEL <matm <at> gmx.fr>

Date: Mon, 19 Feb 2024 03:19:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mathias MICHEL <matm <at> gmx.fr>
Subject: bug#69261: closed (Re: bug#69261: 'ls' : --ignore does not apply
 on FILEs selection)
Date: Mon, 19 Feb 2024 06:46:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#69261: 'ls' : --ignore does not apply on FILEs selection

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 69261 <at> debbugs.gnu.org.

-- 
69261: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69261
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Mathias MICHEL <matm <at> gmx.fr>
Cc: 69261-done <at> debbugs.gnu.org
Subject: Re: bug#69261: 'ls' : --ignore does not apply on FILEs selection
Date: Sun, 18 Feb 2024 22:45:00 -0800
On 2024-02-18 14:07, Mathias MICHEL via GNU coreutils Bug Reports wrote:

> Is it expected that --ignore arg does not apply on globbed FILE ?

Yes. --ignore is about what 'ls' finds in directories, not about 
command-line arguments.

> My goal is to avoid using grep or complex find args:
>> > ~/.ssh :: ls id_ed* | grep -v "\.pub$" > id_ed25519 id_ed25519.local id_ed25519_ori

Try this:

  ls --hide='[^i]*' --hide='i[^d]*' --hide='id[^_]*' --hide='id_[^e]*' 
--hide='id_e[^d]*' --hide='*.pub'

Admittedly ugly, but does the job.

[Message part 3 (message/rfc822, inline)]
From: Mathias MICHEL <matm <at> gmx.fr>
To: bug-coreutils <at> gnu.org
Subject: 'ls' : --ignore does not apply on FILEs selection
Date: Sun, 18 Feb 2024 22:07:39 +0000
[Message part 4 (text/plain, inline)]
Hello,
Is it expected that --ignore arg does not apply on globbed FILE ?
My goal is to avoid using grep or complex find args:
> ~/.ssh :: ls id_ed* | grep -v
"\.pub$"id_ed25519id_ed25519.localid_ed25519_ori
> ~/.ssh:: find . '!' -name '*.pub' -name
"id_ed*"./id_ed25519_ori./id_ed25519.local./id_ed25519
I tried -I (--ignore) and --hide :
> ~/.ssh:: ls -I"*.pub" id_ed*     id_ed25519  id_ed25519.local
 id_ed25519.local.pub  id_ed25519_ori
 id_ed25519_ori.pub    id_ed25519.pub> ~/.ssh:: ls --hide "*.pub"
id_ed*    id_ed25519  id_ed25519.local  id_ed25519.local.pub
 id_ed25519_ori  id_ed25519_ori.pub    id_ed25519.pub
Since help text says for both options is : do not list implied entries
matching shell PATTERN
I would expect it to occur after building the initial listing.
When I remove the globbing pattern, it seems to work as expected:
~/.ssh:: ls -I "*.pub" ./config    id_ed25519  id_ed25519.local
 id_ed25519_ori  id_rsa.local  known_hosts  known_hosts.old~/.ssh:: ls
-I "*.pub"config    id_ed25519  id_ed25519.local  id_ed25519_ori
 id_rsa.local  known_hosts  known_hosts.old
Man page says nothing about conflicts with file globbing. My view is
obviously that this is a miss, what are yours ?
Thanks for your feedback--
Mathias M
[Message part 5 (text/html, inline)]

This bug report was last modified 1 year and 90 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.