With the mkdir
command if I want this location to exist ~/test/panda/fat
when only the ~
part of it exists so far I have to do something like this:
mkdir ~/test
mkdir ~/test/panda
mkdir ~/test/panda/fat
Though it would be much more useful if I could just run something like mkdir ~/test/panda/fat
and rather than just getting this error:
mkdir: cannot create directory ‘/home/$USER/test/panda/fat’: No such file or directory
Actually have it create the directory test
in ~
, then the directory panda
in ~/test
, and then finally the directory fat
in that sub-directory. Am I missing something? Is there a way of doing this as it would be very useful? What would in fact be even more useful in certain situations is for me also to be able to also automatically create a file at the end so that it would create all those directories and then the file bamboo.txt
in fat
and for all this to be in the same command (obviously not requiring there to be a file at the end though).
If there is not already a command which can do this (which I would be surprised if there isn't), then how can I make a script to make this so?
I am running Ubuntu GNOME 15.10 with GNOME 3.18.