Skip to main content

Globbing Patterns: Match Files

Globbing patterns match files. Wildcards. Ranges. Useful.

Here's the thing: Globbing matches files. Learn patterns. Use them.

Wildcards

*.txt
file?.txt

My take: * matches many. ? matches one.

Ranges

file[0-9].txt
file[a-z].txt

My take: [] matches ranges. Use them.

Common Patterns

Match Files

for file in *.txt; do
process "$file"
done

What's Next?

Now that you understand globbing, let's talk about Regex In Bash.


Personal note: Globbing seemed simple at first. Then I learned patterns. Now I use them constantly. They're useful. Learn them.