Node:Patterns, Previous:Matching, Up:Strings
Certain special characters in a word have special meaning.
?
means to match any single character,
except NewLine and NUL. Additionally, when matching against
files names (as in a command line), the ?
doesn't
match a /
or an initial .
.
*
means means to match any number of characters,
with the same exceptions as for ?
.
*(pattern)
means to match any number of matches
for pattern. Note that the left parenthesis must
explicitly follow the star.
This feature subsumes some of the use of the Unix find
program
when its used for matching files names:
Q1> ls -i ../dld/*(*/)Makefile 53639 ../dld/Makefile 51872 ../dld/test/overlay/Makefile 32863 ../dld/test/Makefile 36295 ../dld/test/reload/Makefile 64017 ../dld/test/add1/Makefile 53631 ../dld/test/simple/Makefile 41491 ../dld/test/general/Makefile
?(pattern)
means to optionally match the pattern
(i.e. zero or one times).
+(pattern)
means to match one or more matches of pattern.
[charset]
means to matches any single
character in the charset.
pattern1|pattern2
Quoting a character with \
turns off globbing for it:
Q1> echo Makefi\* Makefi*Alternatively, you can use string quotes:
Q1> echo "Makefi*" Makefi*