Script starts with a "/bin/sh" shebang. Should be either /bin/bash or someone cares about the double bracket tests inside, seems that dash (which some ( debian, mint e.g.) have choosen as the system shell, doesnt like them ...
I was too lazy, changed it to /bin/bash
Greez,
karl