支持的通配符 |
Wildcard Matches |
? Any single character |
* Any string of characters |
[set] Any character in set |
[!set] Any character not in set |
假设当前目录中有文件bob, darlene, dave, ed, frank和fred |
Expression Yields |
fr* frank fred |
*ed ed fred |
b* bob |
*e* darlene dave ed fred |
*r* darlene frank fred |
* bob darlene dave ed frank fred |
d*e darlene dave |
g* g* |
通配符[set]和[!set] |
Expression Matches |
[abc] a, b, or c |
[.,;] Period, comma, or semicolon |
[-_] Dash or underscore |
[a-c] a, b, or c |
[a-z] All lowercase letters |
[!0-9] All non-digits |
[0-9!] All digits and exclamation point |
[a-zA-Z] All lower- and uppercase letters |
[a-zA-Z0-9_-] All letters, all digits, underscore, and dash |
Brace Expansion |
b{ed,olt,ar}s =>beds bolts bars |
b{ar{d,n,k},ed}s => bards barns barks beds |
{2..5} => 2 3 4 5 |
{d..h} => d e f g h |
b{o}lt => b{o}lt |
b{o,}lt => bolt blt |