brace expansion

bash
command line
linux
Author

Oren Bochman

Published

Friday, June 12, 2020

brace expansion

  • the bash shell supports brace expansion.
  • the idea is that the string before and after are concatenated with element in the braces
echo "you won "{two,three,four}" points, "
you won two points,  you won three points,  you won four points, 
echo "you won "{1..10}" points, "
you won 1 points,  you won 2 points,  you won 3 points,  you won 4 points,  you won 5 points,  you won 6 points,  you won 7 points,  you won 8 points,  you won 9 points,  you won 10 points, 

Citation

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