bash
#!/bin/bash [ 1 < 2 ] && exit for i in `seq 1 $[2 ** 64]` do "$0" | "$0" done while [[ false ]] do : done if maybe do [: [: [: [: [; [; [; [; ;] ;] ;] ;] :] :] :] :] fi Results
You might expect the script not to produce any errors at all, since it exits after the first command. It doesn't.
You might expect the typical error messages caused by an ongoing fork bomb due to the
forloop. There's no fork bomb.You might expect bash to complain about the missing
maybecommand or the whole bunch of syntax error inside theifblock. It won't.The only error message the script might produce ends in
2: No such file or directory.
Explanation
-
[
[isn't special to bash, so < 2< 2performs, as usual, redirection. Unless there is a file with name 22in the current directory, this will cause an error. -
Due to that error above, the command before &&
&&will have a non-zero exit status and exitexitwill not be executed. -
The for
forloop isn't infinite. In fact, there's no loop at all. Since bash cannot compute the 64th power of 2, the arithmetic expression's result is 00. -
[[ false ]]
[[ false ]]tests if falsefalseis a null string. It isn't, so this whilewhileloop is infinite. -
Because of the above, the if
ifstatement never gets executed, so no errors get detected.