glob (programming)
From Wikipedia, the free encyclopedia
In computer programming, the verb glob or globbing is used to refer to an instance of pattern matching behavior. The noun glob is sometimes used to refer to a particular pattern, e.g. "use the glob *.log to match all those log files".
Many command line interpreters (shells) such as Unix shells, cmd.exe and Windows PowerShell, provide globbing on filenames at the command line and in shell scripts.[1]
The term glob is also used to refer more generally to limited pattern matching facilities of this kind in other contexts:
- Larry Wall's Programming Perl discusses glob in the context of the Perl language.
- Tcl contains both true regular expression matching facilities and a more limited kind of pattern matching often described as globbing.
- Python has a glob module in the standard library which performs wildcard pattern matching on filenames.
- Ruby has a glob method for the Dir class which performs wildcard patten matching on filenames. Several libraries such as Rant and Rake provide a FileList class which has a glob method or use the method FileList.[] identically.
[edit] Etymology
glob() is a Unix library function that expands file names using a pattern-matching notation reminiscent of regular expression syntax but without the expressive power of true regular expressions.
[edit] References
- ^ The "Advanced Bash-Scripting Guide, Chapter 19.2: Globbing" (Mendel Cooper, 2003) has a concise set of examples of filename globbing patterns.
[edit] See also
This operating system-related article is a stub. You can help Wikipedia by expanding it |