[TUHS] Filename wildcarding (was: origin of the name 'glob')

Johnny Billquist bqt at update.uu.se
Mon Jul 10 19:27:18 AEST 2017


On 2017-07-09 23:44, ron minnich <rminnich at gmail.com> wrote:
> On Sun, Jul 9, 2017 at 2:29 PM Dave Horsfall <dave at horsfall.org> wrote:
>>
>> I vaguely remember something like "PIP *.TXT *.OLD" to rename files (the
>> "*" was interpreted by the command itself, not the interpreter).

Well, that would not rename files, but copy them and at the same time 
changing their names. But you could also do renaming in a similar way, 
but usually it would require a switch to PIP telling it that you wanted 
the files renamed, and not copied.

Also, the syntax of PIP, and the order of arguments is a bit different.

At least the versions I can remember right now, it would be:

PIP *.OLD=*.TXT

to copy, and

PIP *.OLD/RE=*.TXT

to rename.

And yes, it is the program who process the wildcard expansions, and not 
the command interpreter. Which is why commands like the ones above 
worked. This is one of those classical examples you get to when 
comparing Unix with DEC OSes about wildcarding, and the effects the 
different ways they are done have on the result.
(In Unix, you can't do such a mass copy and rename in the same way.)

> All the DEC-10 and 11 operating systems I used had that wildcard, as well
> as IIRC even the PDP-8, maybe someone can confirm the -8.

Yes. It's the same on the OSes I've used on PDP-8s as well.
I would say that the globbing in Unix have much less to do with regular 
expressions and much more to do with trying to mimic what DEC was doing 
in their OSes.

> It would have been nice had RE's been the standard way to glob files, but,
> that said, when I mention .*\.c to people instead of *.c they don't much
> like it.

In a way, it would have made more sense to just use standard RE's for 
globbing, but that didn't happen. And like I said, I suspect it was 
because DEC OSes did it this way, and Unix just mimicked it. Same I 
guess with the convention of '.' to separate filename from type. Even 
though it's less pervasive in Unix than in DEC systems.

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt at softjar.se             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the TUHS mailing list