Answer the question
In order to leave comments, you need to log in
How to create multiple files in the same directory with touch in bash terminal?
There is an app-search directory.
I need to create app-search.js and app-search.scss files inside.
I registered the command touch app-search/{app-search.js, app-search.scss}
But, 2 files with curly braces were created.
And is it possible to register a command in the terminal to create a directory and the necessary files in it?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Actually, your original method also works, just remove the spaces.
touch app-search/{app-search.js,app-search.scss}
You can do it like this, for example:
touch app-search/app-search.js, app-search/app-search.scss
cd /path/to/app-search; touch app-search.js, app-search.scss
/path/to/app-search/app-search.js
/path/to/app-search/app-search.scss
for i in `cat /tmp/list`; do touch $i; done;
chmod +x touch_my_files.sh
./touch_my_files.sh
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question