0

if statement is not working

if [ "$diff" -eq 1 ] && [ "$diff1" -eq 1 ] && [ "$diff3" -eq 1 ];

then

$ch=1

fi

please anyone help me with this.

error is [: : integer expression expected

1
  • In bash this works: if [ "$diff" == 1 ] && [ "$diff1" == 1 ] && [ "$diff3" == 1 ]; or if [ $diff -eq 1 ] && [ $diff1 -eq 1 ] && [ $diff3 -eq 1 ]; Commented Jan 13, 2016 at 10:26

1 Answer 1

0

You can try like this,

if [[ ("$diff" == 1 && "$diff1" == 1  &&  "$diff3" == 1) ]]; then
    $ch=1
fi
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.