Search code examples
linuxbashscriptingbrace-expansion

touch command create multiple files (different names) under one directory


I wanted to make a script that creates a directories and files structure in bash.

I tried something like this:

"mkdir -p 1/2 && touch 1/2/{a b c}"

a,b,c should be files created in one command or something..

but for some reason the structure goes like this

current folder: b c 1

1: 2

2: a

touch can't be used to create multiple files with different names in one directory?


Solution

  • I suggest to add ,:

    mkdir -p 1/2 && touch 1/2/{a,b,c}