GLOB(7) BSD Reference Manual GLOB(7)
glob - shell-style pattern matching
Globbing characters (wildcards) are special characters used to perform pattern matching of pathnames and command arguments in the mksh(1), csh(1), and sh(1) shells as well as the C library functions fnmatch(3) and glob(3). A glob pattern is a word containing one or more unquoted '?' or '*' characters, or "[..]" sequences. Globs should not be confused with the more powerful regular expressions used by programs such as grep(1). While there is some overlap in the spe- cial characters used in regular expressions and globs, their meaning is different. The pattern elements have the following meaning: ? Matches any single character. * Matches any sequence of zero or more characters. [..] Matches any of the characters inside the brackets. Ranges of characters can be specified by separating two characters by a '-' (e.g. "[a0-9]" matches the letter 'a' or any digit). In order to represent itself, a '-' must either be quoted or the first or last character in the character list. Similarly, a ']' must be quoted or the first character in the list if it is to represent itself instead of the end of the list. Also, a '!' appearing at the start of the list has special meaning (see below), so to represent itself it must be quoted or appear later in the list. Within a bracket expression, the name of a character class en- closed in '[:' and ':]' stands for the list of all characters be- longing to that class. Supported character classes: alnum cntrl lower space alpha digit print upper blank graph punct xdigit These match characters using the macros specified in ctype(3). A character class may not be used as an endpoint of a range. Note that character classes may not be universally supported. [!..] Like [..], except it matches any character not inside the brack- ets. \ Matches the character following it verbatim. This is useful to quote the special characters '?', '*', '[', and '\' such that they lose their special meaning. For example, the pattern "\\\*\[x]\?" matches the string "\*[x]?". Note that when matching a pathname, the path separator '/', is not matched by a '?', or '*', character or by a "[..]" sequence. Thus, /usr/*/*/X11 would match /usr/X11R6/lib/X11 and /usr/X11R6/include/X11 while /usr/*/X11 would not match either. Likewise, /usr/*/bin would match /usr/local/bin but not /usr/bin.
fnmatch(3), glob(3), re_format(7)
In early versions of UNIX, the shell did not do pattern expansion itself. A dedicated program, /etc/glob, was used to perform the expansion and pass the results to a command. In Version 7 AT&T UNIX, with the introduc- tion of the Bourne shell, this functionality was incorporated into the shell itself. MirOS BSD #10-current February 11, 2016 1
Generated on 2016-04-09 18:24:16 by $MirOS: src/scripts/roff2htm,v 1.83 2016/03/26 23:38:28 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2016 The MirOS Project, Germany.
This product includes material provided by mirabilos.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.