Good afternoon,
I am tearing hair out over this. It should be so simple. I have an if statement to evaluate whether or not replication is working. I am testing variables from mysql to see if they are both "Yes". I have put some echo statements in to see how far the code proceeds. It always seems to skip the initial test (or evaluate it as false) and run to the end of the script. I could really use another pair of eyes on this.
Thanks
Jim
Thanks Chubler_XL that will save a few lines. I had it expanded like that so I could stick "echo" in as needed to see where It got on each try. I also just ran with a space after and before each [ ], no joy.
Thanks, and yes I was careful about that and am only trying to do a comparison of Yes == Yes.
---------- Post updated 12-19-12 at 08:00 AM ---------- Previous update was 12-18-12 at 06:37 PM ----------
Just a bump here. I thought that this would be easy and some code wizard would just tell me "Oh, you forgot a comma here". Maybe I'm not as crazy as I thought.
Jim
---------- Post updated at 08:41 AM ---------- Previous update was at 08:00 AM ----------
I solved this one and am posting the solution for anyone else to benefit from. The problem is I don't yet know why it works
I changed the Yes == Yes test to a negative and added the space after and before the [ ].
if [ $io != $var -o $sql != $var ]; then
mail -s "replication broke" emailaddr@gmail.com < /tmp/variables
fi
The space I had tried previously with no good result so why changing to a negative made any difference I don't know.