Imagine my current directory is A. I want to create the directory B and the file named "myfile.txt" inside the directory B.
How to do this in one command using a Terminal?
Edit:
The directory can be nested multiple times. I would like to create B/C/D and then a file named "myfile.txt" inside that. I don't want to repeat my directory part.
The following command will create a directory at any level.
mkdir -p B/C/D
and
mkdir -p B/C/D && touch B/C/D/myfile.txt
This is to create a directory and a file. But I do not want to repeat this directory part after each touch command. Is this possible?