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 Answer
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.
1 Comment
Harshavardhan
thanks.... I'm not much aware of unix commands. So I wasn't thought that way. Thank you for pointing that :)
mkdir -p /nonexisting/dir/nonesuch/v2which will create that set of directories, even though none of them exist. In the future, useman mkdirto see available options. Good luck.