• 4am@lemm.ee
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    “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?

    • T. Hex@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      Because now touch does two things.

      Without touch, we could “just” use the shell to create files.

      : > foo.txt
      
      • deegeese@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Touch does one thing from a “contract” perspective:

        Ensure the timestamp of <file> is <now>