0

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

Like directory name starts from 1-100.

mkdir 1..100

2 Answers 2

2
for folder in $(seq 1 100);do mkdir $folder;done
3
  • pls high light the cmd Commented Oct 27, 2018 at 4:18
  • [root@localhost test1]# $(seq 1 100);do mkdir $folder -bash: syntax error near unexpected token `do' Commented Oct 27, 2018 at 4:19
  • @Suresh copy the whole command including from the “for” Commented Oct 27, 2018 at 4:20
1

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

mkdir $(seq 1 100)

Or, in bash,

mkdir {1..100}
2
  • It should be mkdir $(seq 1 100),and yes a for loop is not necessary in this case,I just got used to it.. Commented Oct 27, 2018 at 5:11
  • Or even mkdir {001..100} Commented Oct 27, 2018 at 8:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.