May 2017
Beginner
552 pages
28h 47m
English
Functions in Bash also support recursion (the function can call itself). For example, F() { echo $1; F hello; sleep 1; }.
Fork bomb
A recursive function is a function that calls itself: recursive functions must have an exit condition, or they will spawn until the system exhausts a resource and crashes.
This function: :(){ :|:& };: spawns processes forever and ends up in a denial-of-service attack.
The & character is postfixed with the function call to bring the subprocess into the background. This dangerous code forks processes forever and is called a fork bomb.
You may find it difficult to interpret the preceding code. Refer to the Wikipedia page h t t p ://e n . w i k i p e d i a . o r g /w i k i /F o r k _ b o ...