bash's globstar considered dumb (** not composable)

Mel Wilson mwilson-4YeSL8/OYKRWk0Htik3J/w at public.gmane.org
Sat Sep 24 21:34:14 UTC 2011


On 11-09-24 04:17 PM, D. Hugh Redelmeier wrote:
> In the shell, you can write a kind of regular expression to designate
> all files which match that expression.  For example, "*.c" designates
> all filenames which end in ".c".
>
> Many years ago, I thought about how the notation ** isn't useful (it
> would just be a synonym for *). and how it could be given another
> interesting meaning.  I thought: why not allow it to match files
> within subdirectories too.

Multics used the notation, but Multics filenames (actually segment 
names, but we're not going to quibble) were formally made up of 
components separated by '.' .  "*" in a starname would match any 
single component or part of a component of a filename:

"*.pl1" would match "a.pl1" or "b.pl1" but not "a.b.pl1"
"a*.pl1" would match "a.pl1", "ab.pl1", "abc.pl1", etc.
"*.*.pl1" would match "a.b.pl1"
"a.*.pl1" would match "a.b.pl1" but not "a.b.c.pl1"

"**" would match an number of components:

"**.pl1" would match anything ending in ".pl1"
"a.**.pl1" would match anything starting with "a." and ending in ".pl1"
"a**" would match anything starting with "a" .

(Sure hope I've remembered this right.)

	Mel.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list