CPLD detection would sometimes fail if emulator was running, so fail
with a message to stop the emulator _before_ detection. The emulator
check will remain in nprog too for those who run that directly.
When executed under sudo the wrong shell is used by Debian, causing an
error. This patch fixes the script so it specifies which shell to use.
Note that you don't need to run flash.sh under sudo because it sudos
itself.