Hi All,
I've contacted Altera and although Ubuntu isn't on the supported list they have come back with an answer, I've copied below.
One point that we have found with Ubuntu. Most things do work well, however the issue that you mention in your note is very similar to some other .sh issues that we have seen. On Ubuntu, this is commonly resolved by changing the symbolic link for /bin/sh from /bin/dash to /bin/bash:
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh
Dash and Bash have a slightly different syntax, and that gets us around most issues.
I've given it a shot within the nios2 command shell in Qsys and it does indeed generate a flash file. I've not tried it on the board yet but this is significantly better than before.
Thanks to Stef and Kris over at Altera.