glob (programming)

The glob() function and the underlying gmatch() function originated at Bell Labs in the early 1970s alongside the original AT&T UNIX itself and had a formative influence on the syntax of UNIX command line utilities and therefore also on the present-day reimplementations thereof.

Among those utilities were also two command line tools called glob and find; each could be used to pass a list of matching filenames to other command line tools, and they shared the backend code subsequently formalized as glob() and gmatch().

The Unix shell's -f option to disable globbing — i.e. revert to literal "file" mode — appeared in the same version.

The glob pattern quantifiers now standardized by POSIX.2 (IEEE Std 1003.2) fall into two groups, and can be applied to any character sequence ("string"), not just to directory entries.

The glob command, short for global, originates in the earliest versions of Bell Labs' Unix.

That program performed the expansion and supplied the expanded list of file paths to the command for execution.

The Bash shell also supports the following extensions:[9] The original DOS was a clone of CP/M designed to work on Intel's 8088 and 8086 processors.

Windows shells, following DOS, do not traditionally perform any glob expansion in arguments passed to external programs.

On the Windows API end, the glob() equivalent is FindFirstFile, and fnmatch() corresponds to its underlying RtlIsNameInExpression.

Many implementations of SQL have extended the LIKE operator to allow a richer pattern-matching language, incorporating character ranges ([…]), their negation, and elements of regular expressions.

[17] Beyond their uses in shells, globs patterns also find use in a variety of programming languages, mainly to process human input.

A screenshot of the original 1971 Unix reference page for glob – the owner is dmr , short for Dennis Ritchie .
The dir command with a glob pattern in IBM PC DOS 1.0.