I have a script that will Notify when a threshold value is exceeded. I have most of the code of the code in place , except the threshold part does not render logically correct.
I have placed below the part of the code giving me a problem. I am not sure why it says 7 is greater than 10.
Please help. Thanks
You're comparing a string with an integer. That always produces confusing.
First you set $MaxQueueCount to 10 – that's an integer. Then you fill $FileQueueCount with the path to a file. Then you set $var to 7 – that's an integer either – yet. Then you write this integer to the file the path you stored before in $FileQueueCount. Now you fill in $QueueCount with the text (string) of this file. After you showed the content of the variable $QueueCount on the console you compare then the content of the variable $QueueCount, what's still a string, with the content of the variable $MaxQueueCount – what's an integer. If I'm not wrong has 7 the ASCII code 55 – so it's greater than or equal to 10. 😉
To correct your code and produce the result you probably expect you can do either this