In computer programming, glob () patterns specify sets of filenames with wildcard characters. For example, the Unix Bash
shell command Show
In addition to matching filenames, globs are also used widely for matching arbitrary strings (wildcard matching). In this capacity a common interface is Origin[edit]A screenshot of the original 1971 Unix reference page for The glob command, short for global, originates in the earliest versions of Bell Labs' Unix.[1] The command interpreters of the early versions of Unix (1st through 6th Editions, 1969–1975) relied on a separate program to expand wildcard characters in unquoted arguments to a command: /etc/glob. That program performed the expansion and supplied the expanded list of file paths to the command for execution. Glob was originally written in the B programming language. It was the first piece of mainline Unix software to be developed in a
high-level programming language.[2] Later, this functionality was provided as a C library function, Traditionally, globs do not match hidden files in the form of Unix dotfiles; to match them the pattern must explicitly start with Syntax[edit]The most common wildcards are
Normally, the path separator character ( Unix-like[edit]On Unix-like systems
The ranges are also allowed to include pre-defined character classes, equivalence classes for accented characters, and collation symbols for hard-to-type characters. They are defined to match up with the brackets in POSIX regular expressions.[6][7] Unix globbing is handled by the shell per POSIX tradition. Globbing is provided on
filenames at the command line and in shell scripts.[8] The POSIX-mandated Some shells (such as the C shell and Bash) support additional syntax known as alternation or brace expansion. Because it is not part of the glob syntax, it is not provided in The Bash shell also supports the following extensions:[9]
Windows and DOS[edit]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. Shells may use an expansion for their own builtin commands:
Windows and DOS programs receive a long command-line string instead of argv-style parameters, and it is their responsibility to perform any splitting, quoting, or glob expansion. There is technically no fixed way of describing wildcards in programs since they are free to do what they wish. Two common glob expanders include:[12]
Most other parts of Windows, including the Indexing Service, use the MS-DOS style of wildcards found in CMD. A relic of the 8.3 filename age, this syntax pays special attention to dots in the pattern
and the text (filename). Internally this is done using three extra wildcard characters, SQL[edit]The SQL
Standard SQL uses a glob-like syntax for simple string matching in its Many implementations of SQL have extended the Compared to regular expressions[edit]Globs do not include syntax for the Kleene star which allows multiple repetitions of the preceding part of the expression; thus they are not considered regular expressions, which can describe the full set of regular languages over any given finite alphabet.[16]
Globs attempt to match the entire string (for example, Implementing as regular expressions[edit]The original Mozilla proxy auto-config implementation, which provides a glob-matching function on strings, uses a replace-as-RegExp implementation as above. The bracket syntax happens to be covered by regex in such an example. Python's fnmatch uses a more elaborate procedure to transform the pattern into a regular expression.[17] Other implementations[edit]Beyond their uses in shells, globs patterns also find use in a variety of programming languages, mainly to process human input. A glob-style interface for returning files or an fnmatch-style interface for matching strings are found in the following programming languages:
See also[edit]
References[edit]
Which command will display the current working directory on screen?Use the pwd command to write to standard output the full path name of your current directory (from the /(root) directory). All directories are separated by a slash (/).
What directory on a Linux system is commonly used to store log files and spools?CIT222 Chapter 4- Linux Filesystem Management Key Terms. Which command can be used to display the contents of a file called data?You can also use the cat command to display the contents of one or more files on your screen. Combining the cat command with the pg command allows you to read the contents of a file one full screen at a time. You can also display the contents of files by using input and output redirection.
Which command can be issued to view all users currently logged on to a server and their tasks?who command is used to get the list of the usernames who are currently logged in. Output of the who command contains the following columns: user name, tty number, date and time, machine address.
|