Accepted answer

if you're asking whether you can choose a parameter $1 so that this condition is true for any integer value of $toto, then yes:

./yourscript "0 -o foo"

this makes any condition become

test 1234 -eq 0 -o foo

this is the equivalent of 1234 == 0 || "foo" in other languages, with one irrelevant comparison or'd with the truth value of the string foo.

since test considers all non-empty strings to be true, this expression is always true.


as @that other guy said, the "0 -o whatever" will bypass the check. the reason why it does is because of the -o option of the test binary:

expression1 -o expression2
              either expression1 or expression2 is true

so basically what the script will do is test if

$toto -eq 0 || "whatever"

since non empty string are always true the overall check result will be true and here is the bypass :)

Related Query

More Query from same tag