Can anyone help me with this section of code?
The scenario is a value drops from A to B or A to C or B to C.
If it drops from A to B or B to C, we print "Drop one level"
If it drops from A to C, we print "Dropped two levels".
The problem is script is throwing error when comparing variable values.
A test script is shown below:
# var1=A
# var2=B
# var3=C
# if [ $var1 = "A" && $var2 = "B" ] || [ $var2 = "B" && $var3 = "C" ];
> then
> echo "Down one level"
> fi
ksh: test: ] missing
ksh: test: ] missing
If I remove the last comparison after the "||" sign the script works!
I have tried troubleshooting, but not getting it right.
Can anyone help me?