Forrest logo
back to the [[ tool

shell:warp:221cc

Check if two numbers are equal
$ [[ ${integer_a} -eq ${integer_b} ]]
try on your machine

This command is using the conditional expression syntax in bash to compare the values of two variables, integer_a and integer_b.

The double square brackets [[ are used to enclose the conditional expression.

${integer_a} and ${integer_b} are the variables whose values are being compared.

The -eq comparison operator is used to check if the two values are equal.

If the condition is true i.e., if the values of integer_a and integer_b are equal, the command will return a true exit status (0), and if the condition is false, it will return a false exit status (1).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the [[ tool