• 0 Posts
  • 12 Comments
Joined 3 years ago
cake
Cake day: July 23rd, 2023

help-circle





  • gnutrino@programming.devtoScience Memes@mander.xyzaliens
    link
    fedilink
    English
    arrow-up
    22
    ·
    19 days ago

    Hypothetical example:

    You have a standard measuring stick of length 1u. The guy at the quarry cutting blocks cuts them to 1u (or 2u or some other small integer multiple of u) because that can be conveniently measured by stick. The guy making measuring wheels makes them 1u radius (or diameter or whatever) because, again, that’s convenient to measure by stick. But the guy responsible for surveying the whole pyramid base uses the wheel because it’s easier to go “100 wheel rotations that way” than mess about putting sticks end on end hundreds of times.

    Several millennia pass and some conspiracy nut looks at the number of blocks per side and it comes out to a round number of multiples of pi. OMG, what were they trying to tell the aliens etc.








  • So, it uses the fact that bash allows functions with non-alphanumeric names, in this case it defines a function called :. If we rename that to, for example bomb it becomes a little clearer:

    bomb(){ bomb | bomb& };bomb

    This defines a function that calls itself piped into a version of itself in a separate, background, process (that’s what the & does) and then calls that function. Calling itself means the function never ends (it’s essentially a recursive version of an infinite loop) and the extra background process that is created each time it’s called means that it just keeps exponentially creating new processes that don’t exit and each of which infinitely forks off more processes until the OS runs out of resources (unless you use ulimit to set per-session/per-user process limits - this may even be done by default on some distros these days, it’s been a while since I looked)