Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash if string check

Tags:

bash

I am evaluating following following expression. And it always evaluates to true even if CMD is START or STARTED. Am I doing something wrong?

if [ "$CMD"="START" ]; then
    echo fi
fi
like image 316
Sirish Avatar asked Jun 22 '26 10:06

Sirish


1 Answers

Try spaces

if [ "$CMD" = "START" ] ; then
     echo fi
fi
like image 162
Michael Krelin - hacker Avatar answered Jun 25 '26 04:06

Michael Krelin - hacker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!