I need to write a script to create 5 new directories under 'qwe' dir of all the above 3 dir structures. these 5 dir will have same name.
I don't want to use 15 mkdir statements. i just want to write 5 mkdir statemets and use them 3 times. I appreciate any help.
Thanks Rohan. I am using mkdir -p option. my req is not to create dir1 to dir5 one below the other but to create all 5 under 'qwe'
/xyz/abc/123/qwe/dir1
/xyz/abc/123/qwe/dir2
.
.
/xyz/def/123/qwe/dir4
.
.
.
./xyz/ghi/123/qwe/dir5
thanks Anchal...it works !
Still 1 more doubt is there any way we can assign the path
'/xyz/abc/123/qwe' to a variable and then use it in for loop's condition? like
path1 = /xyz/abc/123/qwe
path2 = /xyz/dfe/123/qwe
path3 = /xyz/ghi/123/qwe
for dir in path1 path2 path3
do
mkdir -p $dir/dirA $dir/dirB $dir/dirC $dir/dirD $dir/dirE
done
path1="/xyz/abc/123/qwe"
path2="/xyz/dfe/123/qwe"
path3="/xyz/ghi/123/qwe"
for dir in $path1 $path2 $path3
do
mkdir -p $dir/dirA $dir/dirB $dir/dirC $dir/dirD $dir/dirE
done
thanx Anurag... 1 more quick doubt/ req
what if the name of the dir 'qwe' is read a command line argument. that is $1 contains the name of the dir. and I need to assign the path1 = "/xyz/abc/123/$1"