[Top][All Lists]

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

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

From: Ilkka Virta
Subject: Could we have GLOBIGNORE ignore . and .. in subdirectories, too?
Date: Thu, 28 May 2020 19:02:18 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

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

reply via email to

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