Entering edit mode
12.5 years ago
Assa Yeroslaviz
★
1.8k
Hi,
I am looking for a way of creating multiple directories using the mkdir -p command in a shell script.
I'm working with an Ubuntu machine and try to do something like that:
#!/bin/sh
# Create required directories to support pipelines (BWAse, BWApe, and others to come...)
echo ***Creating Directory Structure***
mkdir -p "temp/{temp1,temp2, temp3}"
mkdir -p temp/down/{struc1,struc2,struc3,struc4}
I would like to have each of the directories in the {} as sub-directories of the directory before.
The problem is that I get only one directory with the complete name inclusive the {}. It looks like that:
ll -R temp
temp:
total 16
drwxr-xr-x 4 USER 4096 2011-10-11 09:53 ./
drwxr-xr-x 31 USER 4096 2011-10-11 09:53 ../
drwxr-xr-x 3 USER 4096 2011-10-11 09:53 down/
drwxr-xr-x 2 USER 4096 2011-10-11 09:53 {temp1,temp2, temp3}/
temp/down:
total 12
drwxr-xr-x 3 USER 4096 2011-10-11 09:53 ./
drwxr-xr-x 4 USER 4096 2011-10-11 09:53 ../
drwxr-xr-x 2 USER 4096 2011-10-11 09:53 {struc1,struc2,struc3,struc4}/
temp/down/{struc1,struc2,struc3,struc4}:
total 8
drwxr-xr-x 2 USER 4096 2011-10-11 09:53 ./
drwxr-xr-x 3 USER 4096 2011-10-11 09:53 ../
temp/{temp1,temp2, temp3}:
total 8
drwxr-xr-x 2 USER 4096 2011-10-11 09:53 ./
drwxr-xr-x 4 USER 4096 2011-10-11 09:53 ../
What am doing wrong? IS there a way of automating this procedure?
Thanks
Assa