Does the script begin with a proper "#!/bin/sh" or "#!/bin/bash" line? Lacking that, an exec() call will fail, but your shell has a fallback to try running a new instance of itself to interpret the file when it gets an ENOEXEC ("Exec format error") return from the exec() call.
|