How can I ensure that intermidiate components exist? Something like mkdir -p {} but without last component?
mkdir -p {}
Let's say your path is $f
$f
Just run mkdir -p `dirname $f`
mkdir -p `dirname $f`