brace expansion

A quick introduction to bash brace expansion, a powerful feature that allows you to generate multiple strings from a single pattern, making it easier to create lists of items or execute commands with multiple arguments.
bash
command line
linux
Author

Oren Bochman

Published

Friday, June 12, 2020

Modified

Monday, May 18, 2026

Keywords

bash, command line, linux, bash tricks, bash tips

brace expansion

  • the bash shell supports brace expansion.
  • the idea is that the string before and after are concatenated with element in the braces
#| label: bash brace expansion
echo "you won "{two,three,four}" points, "
#| label: bash brace expansion 2
echo "you won "{1..10}" points, "

Citation

BibTeX citation:
@online{bochman2020,
  author = {Bochman, Oren},
  title = {Brace Expansion},
  date = {2020-06-12},
  url = {https://orenbochman.github.io/posts/2020/06-12-bash-tricks/},
  langid = {en}
}
For attribution, please cite this work as:
Bochman, Oren. 2020. “Brace Expansion.” June 12. https://orenbochman.github.io/posts/2020/06-12-bash-tricks/.