Skip to main content

Brace Expansion: Generate Strings

Brace expansion generates strings. Ranges. Lists. Useful.

Here's the thing: Brace expansion generates strings. Learn it. Use it.

Ranges

echo {1..10}
echo {a..z}

My take: Ranges generate sequences. Use them.

Lists

echo {file1,file2,file3}.txt

My take: Lists generate combinations. Use them.

Common Patterns

Generate Files

touch file{1..5}.txt

What's Next?

Now that you understand brace expansion, let's talk about Process Substitution.


Personal note: Brace expansion seemed unnecessary at first. Then I used it. Now I use it constantly. It's useful. Learn it.