Patterns

A pattern consists of normal characters, which match themselves, and meta-characters. The meta-characters are:

!, *, ?, and [

These characters lose their special meanings if they are quoted. When command or variable substitution is performed and the dollar sign ($) or backquote (`) are not double quoted, the value of the variable or the output of the command is scanned for these characters and they are turned into meta-characters.

An asterisk (*) matches any string of characters.

A question mark (?) matches any single character.

A left bracket ([) introduces a character class. The end of the character class is indicated by a right bracket (]). If the right bracket is missing then the left bracket matches a [ rather than introducing a character class. A character class matches any of the characters between the square brackets. A range of characters may be specified using a minus (-). The character class may be complemented by making an exclamation mark (!) the first character of the character class.

Note: Specifying a range of characters may produce different results from other systems because EBCDIC characters are not contiguous.

To include a right bracket in a character class, make it the first character listed (after the !, if any). To include a minus in a character class, make it the first or last character listed.