The problem is that sh
is usually softlinked to a specific shell. It can change even when the context change. In Ubuntu, sh is bash
when you start an interactive shell and dash
if you start a script. When I have switched from 10.04 to 12.04 all my sh shebanged scripts failed ! You might have a version problem as user2864740 pointed out in a comment.
One solution is to use a specific shell in the shebang like /bin/bash
explicitly. Another is to make your scripts work for all the shell versions/flavors you may encounter ^^