• tb_@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    10 months ago

    Because I didn’t know what a fork bomb was:

    a fork bomb is a denial-of-service (DoS) attack wherein a process continually replicates itself to deplete available system resources, slowing down or crashing the system due to resource starvation.

    […]

    A classic example of a fork bomb is one written in Unix shell :(){ :|:& };:, possibly dating back to 1999, which can be more easily understood as

    fork() fork fork & fork

    > 
    > In it, a function is defined (fork()) as calling itself (fork), then piping (|) its result into itself, all in a background job (&).
    > 
    > The code using a colon `:` as the function name is not valid in a shell as defined by POSIX, which only permits alphanumeric characters and underscores in function names. However, its usage is allowed in GNU Bash as an extension.
    
    [Wikipedia](https://en.wikipedia.org/wiki/Fork_bomb)
    • barsoap@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      10 months ago

      You’re telling markdown to format the code in the language fork() { and then break the code block early by not having > in front of the next line. Here’s a quoted code block formatted in sh:

      fork() {
         fork | fork &
      }
      fork
      
      • tb_@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        10 months ago

        It seems the app I use to browse doesn’t play entirely nice with markdown. I updated my formatting a little, thanks for the notice.