GLOB(7) | Miscellaneous Information Manual | GLOB(7) |
?
' 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 special characters used in regular expressions and globs, their meaning is different.
The pattern elements have the following meaning:
?
*
[..]
-
' (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 enclosed in ‘[:
' and ‘:]
' stands for the list of all characters belonging 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.
[!..]
[..]
, except it matches any character not inside the brackets.\
?
', ‘*
', ‘[
', 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.
November 30, 2010 | NetBSD 6.1 |