1

In Bash or Zsh, what is the shortest way to create a folder for each possible combination of substrings? Is there maybe even a notation such as

mkdir {Single|Multi}Lane_{Single|Dual}Carriageway_{USA|Europe}

which should result in the creation of

SingleLane_SingleCarriageway_USA
MultiLane_SingleCarriageway_USA
SingleLane_DualCarriageway_USA
MultiLane_DualCarriageway_USA
SingleLane_SingleCarriageway_Europe
MultiLane_SingleCarriageway_Europe
SingleLane_DualCarriageway_Europe
MultiLane_DualCarriageway_Europe

My substrings also may have more than two options, such as {USA, Europe, Asia}.

2

Change the |s in your command to ,:

mkdir {Single,Multi}Lane_{Single,Dual}Carriageway_{USA,Europe}

3.5.1 Brace Expansion

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.