That's a great question!
If the parent directories already exist when you use mkdir -p, the command will simply do nothing for those existing directories and proceed to create any new, non-existent directories in the path. It won't throw an error or try to overwrite them.
For example, if you already have:
projects/
└── alpha/
And then you run:
mkdir -p projects/alpha/docs
projectsalready exists, somkdir -pskips creating it.alphaalready exists, somkdir -pskips creating it.docsdoes not exist, somkdir -pcreates it insideprojects/alpha/.
So, mkdir -p is robust; it handles both cases where parent directories are missing and where they already exist without issues. It only creates what's needed.
Keep up the great work!