Reputation: 49401
I have a java config file with the following entry
Success=true
All of a sudden this comparison does not seem to equate to Boolean true .
if [ "$Success" == "true" ];then
//do something
fi
I've checked for Windows line endings and spaces. This is bash 5.0.17, which is fairly new. Its running on Solaris. Seems simple enough and we don't want to edit the script if at all possible. What can be other explanations ?
Upvotes: 0
Views: 61
Reputation: 746
Using == for comparison is allowed but not standard.
So the fix could like that:
if [ "$Success" = "true" ]; then
//do something
fi
or
if [[ "$Success" == "true" ]]; then
//do something
fi
Upvotes: 1