Glob (programming) - Implementations

Implementations

Unix shells such as Bash, tcsh, and zsh provide globbing on filenames at the command line and in shell scripts.

Windows shells such as cmd.exe and Windows PowerShell do not glob, but instead rely on the called program or Cmdlet to perform globbing.

The term "glob" is also used to refer more generally to limited pattern-matching facilities of this kind, in other contexts:

  • Go has a Glob function in the filepath module
  • Perl has both a glob function (as discussed in Larry Wall's book Programming Perl) and a Glob extension which mimics the BSD glob routine. Perl's angle brackets can be used to glob as well: <*.log>.
  • PHP has a glob function.
  • Python has a glob module in the standard library which performs wildcard pattern matching on filenames. Guido van Rossum, author of the Python programming language wrote and contributed a glob routine to BSD Unix in 1986. There were previous implementations of glob, e.g., in the ex and ftp programs in previous releases of BSD.
  • Ruby has a glob method for the Dir class which performs wildcard pattern 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.
  • Tcl contains both true regular expression matching facilities and a more limited kind of pattern matching often described as globbing.

Read more about this topic:  Glob (programming)