In the script you use 'command -v' which AFAIK is a bash built-in and thus not available on all shells. Although /bin/sh links to /bin/bash on many systems it does not on every system. So it is possible that it does not work.