Thanks for saving me a chunk of time. A few minor tweeks were needed for me to make it work properly, the most critical was swapping out the "||" for an actual "or", the bitwise operator didn't seem to be catching the return values properly.
A bit more to add and it'll be a fully functional nagios plugin
A