bash - mkdir: omit leading pathname when creating multiple directories? -


this question has answer here:

i'm sure question has been asked elsewhere can't seem phrase in way returns useful google result.

i creating dozen directories have same root path , don't want have cd able make these directories. current command looks like, awful , repetitive:

$ mkdir frontend/app/components/home frontend/app/components/profile \    frontend/app/components/post frontend/app/components/comment 

an ideal syntax along lines of:

$ mkdir frontend/app/components/{home, profile, post, comment} 

is there haven't found? don't want have run for loop make few directories.

your wish granted :-).

mkdir doesn't know , doesn't have to, shells bash or zsh understand syntax {...,...,...}.

just remove spaces "along lines of" , works:

mkdir frontend/app/components/{home,profile,post,comment} 

the shell expand to

mkdir frontend/app/components/home frontend/app/components/profile frontend/app/components/post frontend/app/components/comment 

since done shell, works command.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -