0

I need to create multiple directories using one command.  Is it possible?

Like directory name starts from 1-100.

mkdir 1..100
1

You don’t need a (for...do...done) loop; just do

mkdir $(seq 1 100)

Or, in bash,

mkdir {1..100}
  • It should be mkdir $(seq 1 100),and yes a for loop is not necessary in this case,I just got used to it.. – FrontENG Oct 27 '18 at 5:11
  • Or even mkdir {001..100} – xenoid Oct 27 '18 at 8:27
2
for folder in $(seq 1 100);do mkdir $folder;done
  • pls high light the cmd – Suresh Oct 27 '18 at 4:18
  • [root@localhost test1]# $(seq 1 100);do mkdir $folder -bash: syntax error near unexpected token `do' – Suresh Oct 27 '18 at 4:19
  • @Suresh copy the whole command including from the “for” – FrontENG Oct 27 '18 at 4:20

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.