The [ ] allows one to place specific characters or numbers within the brackets which will be the only choices that can be matched within that character position. For example: the name hat? will match the files hat11 hat12 hat13 hat21 hat22 hat23 . This statement is equivalent to either match all files that began with the characters hat followed by the number 1 or the number 2 followed by one additional character or number. A slightly different variation hat* will match hat1 hat2 hat11 hat12 hat13 hat21 hat22 hat23. Notice that the file names hat1 hat2 are now added to list since this new combination will match all files that start with hat followed by the number 1 or the number 2 followed by zero or any number of additional characters. As a result the files hat1 hat2 are now included in this list.
Ranges of characters can be included by using the notation: [a-m], where a is the beginning of the range of characters to be matched and m is the last. This would match all of the characters starting with a going to m inclusive (remember Linux is case sensitive so this would not include any uppercase characters). Looking again at the list of file names using h[a-m]* would match the filenames hat hat1 hat2 hat11 hat12 hat13 hat21 hat22 hat23 hat31 hat32 hat33 head. Notice that the files h and house do not meet the criteria because they do not have the characters a through m as their second character.
Home - Table Of Contents - Contact Us
CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005
Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.