Additional Shell Filename Wildcards


Other wildcard characters enable you to specify more complex patterns than you can with the * character. The shell wildcards supported by UNIX shells are *, ?, and [ ].

The ? wildcard matches any single character. The [ ] wildcard matches a single character in a list of characters appearing within square brackets. In the figure above, the list command is asked to show only those files whose names start with a capital M and end with a lowercase d, but can have any number of characters in between.

A few examples can help to build your understanding of wildcards. Consider a collection of five files with the names ReadMe.rtf, ReadMe.txt, read.rtf, read.txt, and It's All About Me.rtf:

  • *.rtf matches ReadMe.rtf, read.rtf, and It's All About Me.rtf.

  • ????.* matches read.rtf and read.txt.

  • [Rr]*.rtf matches ReadMe.rtf and read.rtf.

  • [A-Z]* matches ReadMe.rtf, ReadMe.txt, and It's All About Me.rtf.




Apple Training Series. Mac OS X System Administration Reference, Volume 1
Apple Training Series: Mac OS X System Administration Reference, Volume 1
ISBN: 032136984X
EAN: 2147483647
Year: 2005
Pages: 258
Authors: Schoun Regan

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net