#MonthOfCode - Day 26: malicious
My entry for the 26th day of the month of code. The theme for today is: malicious.
I’ve not written today’s code but let’s look at it anyway: :(){ :|:& };:
.
It’s a fork bomb for a UNIX shell
(bash for instance).
With some formatting:
1
2
3
4:() {
: | : &
};
:
It’s a function called :
! Let’s rename it:
1 | fork_bomb() { |
A function is defined then called. Inside the function, it calls itself twice,
in parallel (that’s what the |
does) and it’s non-blocking (that’s what the
&
does). This means that you can’t kill it with Ctrl-C.