AFAICS your script doesn't use any bash specific features. Can you check it's work with standard /bin/sh?