0

I want to create directories with given names through shell script in one go.. rather than writing mkdir command for n number of times to create n number of directories.

1
  • Including actual examples of the problem you are trying to solve makes it so much easier to help. The answer below is correct for one interpretation of your problem. I think you mean mkdir -p /nonexisting/dir/nonesuch/v2 which will create that set of directories, even though none of them exist. In the future, use man mkdir to see available options. Good luck. Commented Feb 22, 2017 at 15:29

1 Answer 1

3

mkdir is able to take any number of arguments, so:

mkdir a b c

would make the trick without the need of any script.

If you really want comma separated list then:

 mkdir `echo a,b,c | sed -e 's/,/ /g'`

will make it.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks.... I'm not much aware of unix commands. So I wasn't thought that way. Thank you for pointing that :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.