glob

<file system, programming>

/glob/ A mechanism that returns a list of pathnames that match a pattern containing wild card characters. Globbing was available in early versions of Unix and, in more limited form, in Microsoft Windows.

The characters are:

* = zero or more characters, e.g. "probab*" would match probabilistic, probabilistically, probabilities, probability, probable, probably.

? = any single character, e.g. "b?g" would match bag, big, bog, bug.

[] any of the enclosed characters, e.g. "b[ao]g" would match bag, bog (not on Windows).

These have become sufficiently pervasive that hackers use them in written messages. E.g. "He said his name was [KC]arl" (expresses ambiguity). "I don't read talk.politics.*" (any of the talk.politics subgroups on Usenet). Other examples are given under the entry for X.

Later Unix shells introduced the x,y,z syntax which expands to a comma-separated list of alternatives, thus foobaz,qux would expand to "foobaz" and "fooqux". This differs from a glob because it generates a list of all possible expansions, rather than matching against existing files.

Glob patterns are similar, but not identical, to regular expressions.

"glob" was a subprogram that expanded wild cards in archaic pre-Bourne versions of the Unix shell. It is also a bulit-in function in Perl.

Last updated: 2014-08-22

Nearby terms:

Glispglitchglobglobal indexglobalisationGlobal Network Navigator

Try this search on Wikipedia, Wiktionary, Google, OneLook.



Loading

  翻译: