Yeah. It could just as well have issued a file not found error when you try to touch a nonexistent file. And we would be none the wiser about what we’re missing in the world.
“Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should touch waste your time?
The intended use of
touch
is to update the timestamp right?Yeah. It could just as well have issued a file not found error when you try to touch a nonexistent file. And we would be none the wiser about what we’re missing in the world.
“Do one thing and do it very well” is the UNIX philosophy after all; if you’re 99% likely to just create that missing file after you get a file not found error, why should
touch
waste your time?Because now touch does two things.
Without touch, we could “just” use the shell to create files.
Touch does one thing from a “contract” perspective:
Ensure the timestamp of <file> is <now>
Systemd also does one thing from a contract perspective: run your system