sh
is interpreting the &&
as a shell operator. Change it to -a
, that’s [
’s conjunction operator:
[ "$arg1" = "$arg2" -a "$arg1" != "$arg3" ]
Also, you should always quote the variables, because [
gets confused when you leave off arguments.