Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16312

Could we have GLOBIGNORE ignore . and .. in subdirectories, too?

From Ilkka Virta <itvirta@iki.fi>
Newsgroups gnu.bash.bug
Subject Could we have GLOBIGNORE ignore . and .. in subdirectories, too?
Date 2020-05-28 19:02 +0300
Message-ID <mailman.546.1590681747.2541.bug-bash@gnu.org> (permalink)
References <1ced5397-877f-a3b9-4ff1-8c08d0065c7a@iki.fi>

Show all headers | View raw


Let's say I want to glob just the files with names starting with dots, 
but not the ubiquitous dot and dot-dot entries, which are seldom a 
useful result of a glob.

That can be done with something like   ..?* .[!.]*   or   .!(|.)   with 
extglob. Both are still a bit annoying to type, and it would be nice to 
just have  .*  do this directly. GLOBIGNORE seems like it could help, 
but it appears the automatic hiding of . and .. only works with globs 
without a path element:  .*  doesn't generate them, but   ./.*   does.

I could add  GLOBIGNORE=.:..:*/.:*/..  to catch them also in 
subdirectories, but then of course that doesn't work for 
sub-sub-directories, etc.


Could it be possible to extend GLOBIGNORE or some other option to have
globs like  foo/.*   not generate  . and .. as the final part of the 
path regardless of the level they are in?

When given explicitly, without a glob in the final part of the path, 
they should probably still be allowed, even if the word was otherwise a 
glob. (e.g. if something like  foo/*/.  happened to be useful in some case.)


-- 
Ilkka Virta / itvirta@iki.fi

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Could we have GLOBIGNORE ignore . and .. in subdirectories, too? Ilkka Virta <itvirta@iki.fi> - 2020-05-28 19:02 +0300

csiph-web