bash - mkdir: omit leading pathname when creating multiple directories? -
this question has answer here:
- bash mkdir , subfolders [duplicate] 3 answers
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
Post a Comment