Most probably the windows partition is mounted with the
noexec flag on. You can confirm in the output of:
In the output you will probably see something like
(rw,noexec) at the end of the line. The
noexec flag is not a default, so this usually happens when it is configured explicitly to mount it that way.
When you run the script with
bash /path/to/script.sh it works,
because in that case you're executing not the script,
but you're executing
bash, which interprets the script given in its argument.
As an additional note:
but interestingly calling it with sh works.
Since the script has the shebang
#!/bin/bash, you should use
bash instead of
sh to execute it. The author of the script probably used this shebang for a reason, and some implementations of
sh (or whatever it's linked to in your system) may not support some Bash features.
to be able to execute the script directly,
you could try to mount the drive with
exec flag instead of
but first think about whether that's really a good idea or not.
The default of mounting with
noexec is for a safety feature,
to prevent accidental execution of potentially harmful files coming from untrusted sources. I don't think you should change that. Just run with