DEV Community

Discussion on: Scare me with your one liner

Collapse
 
deciduously profile image
Ben Lovy • Edited

The classic fork bomb is pretty terrifying:

:(){ :|:& };:

The function is called :. Call it scaryFunc instead:

scaryFunc() {
    scaryFunc() | scaryFunc() &
}; scaryFunc

This function recursively calls itself, then pipes it to another call of itself that gets put in the background with &, meaning the child will not die and just continually recursively call itself, blocking everything else, until it's maxed out your system resources and you crash. It's even multiple-recursive, for extra oomph. After defining the function, we call it.

Don't do this.

Collapse
 
ankitbeniwal profile image
Ankit Beniwal

I won't do it. Pretty Scary. 😱😱