Search This Blog


Path Expansion with Braces

Path expansion with braces
If we want to make an in depth directory structure rather than using mkdir all the way down as follows

We can do it like this
cd /main
mkdir sub1
cd sub1
mkdir subsub1
cd ../
mkdir sub2
cd sub2
mkdir subsub1

Or we can instead use braces for path expansion with the -p argument so that we're specifying a path rather than a single directory
mkdir -p /main/{sub1,sub2}/subsub1

No comments:

Post a Comment