On 03/04/2012 08:16 AM, Stefano Lattarini wrote: > What's going on there?
That is a bug in older ksh implementations. I've pushed the following doc patch to describe it. I don't fully understand your test case, but renaming "script" to "script2" won't work if there happens to be a command named "script2" in the path, so I suggest changing the file name back to "script" but invoking it as "./script", which should work around the ksh bug. [PATCH] doc: mention PATH bug with "ksh foo" * doc/autoconf.texi (Invoking the Shell): Mention ksh PATH bug. --- doc/autoconf.texi | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/doc/autoconf.texi b/doc/autoconf.texi index da34a4e..9442e22 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -15219,6 +15219,22 @@ Bash in Mac OS X 10.2. @cindex invoking the shell @cindex shell invocation +The Korn shell (up to at least version M-12/28/93d) has a bug when +invoked on a file whose name does not contain a slash. It first +searches for the file's name in @env{PATH}, and if found it executes +that rather than the original file. For example, assuming there is a +binary executable @file{/usr/bin/script} in your @env{PATH}, the last +command in the following example fails because the Korn shell finds +@file{/usr/bin/script} and refuses to execute it as a shell script: + +@example +$ @kbd{touch xxyzzyz script} +$ @kbd{ksh xxyzzyz} +$ @kbd{ksh ./script} +$ @kbd{ksh script} +ksh: script: cannot execute +@end example + Bash 2.03 has a bug when invoked with the @option{-c} option: if the option-argument ends in backslash-newline, Bash incorrectly reports a syntax error. The problem does not occur if a character follows the -- 1.7.6.5