Skip to main content

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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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< 2 performs, as usual, redirection. Unless there is a file with name 22 in the current directory, this will cause an error.

  • Due to that error above, the command before &&&& will have a non-zero exit status and exitexit will not be executed.

  • The forfor loop 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 falsefalse is a null string. It isn't, so this whilewhile loop is infinite.

  • Because of the above, the ifif statement never gets executed, so no errors get detected.

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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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 performs, as usual, redirection. Unless there is a file with name 2 in the current directory, this will cause an error.

  • Due to that error above, the command before && will have a non-zero exit status and exit will not be executed.

  • The for loop 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 0.

  • [[ false ]] tests if false is a null string. It isn't, so this while loop is infinite.

  • Because of the above, the if statement never gets executed, so no errors get detected.

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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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 performs, as usual, redirection. Unless there is a file with name 2 in the current directory, this will cause an error.

  • Due to that error above, the command before && will have a non-zero exit status and exit will not be executed.

  • The for loop 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 0.

  • [[ false ]] tests if false is a null string. It isn't, so this while loop is infinite.

  • Because of the above, the if statement never gets executed, so no errors get detected.

added 2 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

bash

#!/bin/bash [ 1 < 2 ] && exit for i in `seq 1 $[2**63]`$[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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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 performs, as usual, redirection. Unless there is a file with name 2 in the current directory, this will cause an error.

  • Due to that error above, the command before && will have a non-zero exit status and exit will not be executed.

  • The for loop 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 0.

  • [[ false ]] tests if false is a null string. It isn't, so this while loop is infinite.

  • Because of the above, the if statement never gets executed, so no errors get detected.

bash

#!/bin/bash [ 1 < 2 ] && exit for i in `seq 1 $[2**63]` 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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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 performs, as usual, redirection. Unless there is a file with name 2 in the current directory, this will cause an error.

  • Due to that error above, the command before && will have a non-zero exit status and exit will not be executed.

  • The for loop 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 0.

  • [[ false ]] tests if false is a null string. It isn't, so this while loop is infinite.

  • Because of the above, the if statement never gets executed, so no errors get detected.

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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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 performs, as usual, redirection. Unless there is a file with name 2 in the current directory, this will cause an error.

  • Due to that error above, the command before && will have a non-zero exit status and exit will not be executed.

  • The for loop 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 0.

  • [[ false ]] tests if false is a null string. It isn't, so this while loop is infinite.

  • Because of the above, the if statement never gets executed, so no errors get detected.

Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

bash

#!/bin/bash [ 1 < 2 ] && exit for i in `seq 1 $[2**63]` 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 for loop. There's no fork bomb.

  • You might expect bash to complain about the missing maybe command or the whole bunch of syntax error inside the if block. 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 performs, as usual, redirection. Unless there is a file with name 2 in the current directory, this will cause an error.

  • Due to that error above, the command before && will have a non-zero exit status and exit will not be executed.

  • The for loop 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 0.

  • [[ false ]] tests if false is a null string. It isn't, so this while loop is infinite.

  • Because of the above, the if statement never gets executed, so no errors get detected.