[TUHS] Origins of globbing

John Cowan cowan at ccil.org
Wed Oct 7 13:14:57 AEST 2020


Noel: Thanks for the heads-up on glob.  It didn't occur to me to look in
manual section 8.

On Tue, Oct 6, 2020 at 7:11 PM George Michaelson <ggm at algebras.org> wrote:

globbing was the application of specific syntax markers to concepts,
>

Certainly.  But I think the specific meanings of "*" to mean "any number of
any characters" and "?" to mean "any character" do not go back further than
1964.

Multics had support for * and ?, but I don't know when that was added or if
it was there from the beginning.  Multics filenames, unlike DEC ones, allow
multiple dots, which are treated specially by these characters: neither ?
nor * can match a dot, but ** can.  So perhaps they got into Unix from
Multics after all.  Stratus VOS is another direct descendant of Multics,
but I don't know if it has globs.

Windows avoids quotation by blocking any of < > " : | ? * from appearing in
pathnames (/ and \ mean the same thing to the kernel, but not to the shell
or to the GUI file picker).  In addition, non-disk device names cannot
appear as part of a filename either before or after the dot: nul.c and
c.nul, for example, are illegal because nul: is a device name, and you can
use \dev\nul to reference the null device even though \dev does not exist.

I think set noglob; <do things>; set glob is often under-appreciated.


I found the absence of set nullglob (which causes *.foo to expand to
nothing if it matches no files) on Solaris 8 very irritating.  It's still
not part of Posix sh, though bash has it.  I wrote some wrappers around cp
and mv that looked for * and ? in the arguments (indicating no files) and
removed those arguments; if no arguments were left after that, they exited
with 0.  Thus "safecp *.bak ../backup" would silently succeed if there were
no .bak files.



John Cowan          http://vrici.lojban.org/~cowan        cowan at ccil.org
I come from under the hill, and under the hills and over the hills my paths
led. And through the air. I am he that walks unseen.  I am the clue-finder,
the web-cutter, the stinging fly. I was chosen for the lucky number.
 --Bilbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20201006/687745ed/attachment.htm>


More information about the TUHS mailing list