The reason that a fork-bomb works is because there is a finite limit to the number of processes that can be running at any one time, and a fork-bomb is designed to fill this limit.
Because the forkbomb code you provided dies if it cannot spawn a child process, the parent processes do not actually hang around, but the fact that the children keep creating new grand*-children keeps the process table full.
So the sleep solution is designed to sneak in some processes that just sleep for a short period of time, and for each sleep process that manages to be created, there are less fork-bombs happening. Eventually the sleep processes fill up the proces table themselves and the fork bombs die off.
Once the process table is full off sleep processes the while loop can be killed, and the sleep processes will die once their sleep time is up. Problem solved.
As has already been mentioned the important part of the zsh command is the run-in-background &
, so the bash command would basically be the same as given in the other answers:
while (sleep 100 &) do; done
I don't think that the nohup
/!
part is important unless you want to log out within the sleep time, but I'd be happy to be set straight if I am wrong.