TIL: Brace expansion
David Viramontes
David Viramontes
Today I learned about Bash brace expansion, a convenient way to generate multiple command arguments without repeating yourself.
It's especially handy when creating sibling directories:
mkdir /some/path/{a,b,c}
Which expands to:
mkdir /some/path/a /some/path/b /some/path/c
It also works nicely when renaming something without retyping the directory:
mv /some/path/{c,d}
Which expands to:
mv /some/path/c /some/path/d