• 48954246@lemmy.world
      link
      fedilink
      English
      arrow-up
      21
      ·
      edit-2
      8 months ago

      Feels dangerous to run. What happens if the file already exists and has something important in it?

      touch -a is probably better

      • gaterush@lemmy.world
        link
        fedilink
        arrow-up
        9
        ·
        8 months ago

        The other command could just be printf '' >> file to not overwrite it. Or even simpler >>file and then interrupt

          • 4am
            link
            fedilink
            arrow-up
            6
            ·
            8 months ago

            .“:>>” is “append null” right? Do you get a file with a single ASCII NUL or is it truly empty?

            • owsei@programming.dev
              link
              fedilink
              arrow-up
              3
              ·
              8 months ago

              Yeah!

              it’s basically a noop, I use it as a placeholder when I’m writing a script, since bash doesn’t accept code blocks with no commands