Filename Substitution

File name substitution is a feature which allows special characters and patterns to substituted with file names in the current directory, or arguments to the case and [[...]] commands.

Pattern-Matching Characters/Patterns

? match any single character
* match zero or more characters, including null
[abc] match any characters between the brackets
[x–z] match any characters in the range x to z
[a–ce–g] match any characters in the range a to c, e to g
[!abc] match any characters not between the brackets
[!x–z] match any characters not in the range x to z
. strings starting with '.' must be explicitly matched
?(pattern-list) match zero or one occurrence of any pattern
*(pattern-list) match zero or more occurrences of any ...

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.