• 4am@lemm.ee
      link
      fedilink
      arrow-up
      6
      ·
      11 months ago

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

      • Trailblazing Braille Taser@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        14
        ·
        11 months ago

        Not really. I believe : is the “true” builtin. So it’s like running a program that exits with zero and writes nothing to stdout. The >> streams the empty stdout into the named file.

      • al177
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        11 months ago

        $ :|wc -c 0 $ touch /tmp/f; :>>/tmp/f; wc -c /tmp/f 0 /tmp/f

      • owsei@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        11 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