I've noticed sometimes I touch a file that does not exist at all and after the command, the files get created. However, depending on what directory I'm touching, I get "No such file or directory" error.
For example, If I run touch foo.txt, the foo.txt file gets created in my home directory. Instead, if I run touch /bar/foo.txt, I get touch: cannot touch '/bar/foo.txt': No such file or directory.
What's the logic behind this? Thanks.
/bardirectory exist? That's whattouchcomplains about. – Arkadiusz Drabczyk Oct 18 '17 at 22:55