I tried the following script
#!/bin/bash var1=\"Test 1\" var2=\"Test 2\" if [ \"$var1\"=\"$var2\" ] then echo \"Equal\" else echo \"Not equa
To add to the existing explanation, "$var1"="$var2" is just a single non-empty string, and thus always evaluates as true in a conditional.
"$var1"="$var2"
[ "$var1"="$var2" ] && echo true
The above command will always print out true (even if var1 and var2 be empty).
true
var1
var2