Next: , Previous: , Up: Portable Shell   [Contents][Index]

C.1.2 Invoking the Shell

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 PATH, and if found it executes that rather than the original file. For example, assuming there is a binary executable /usr/bin/script in your PATH, the last command in the following example fails because the Korn shell finds /usr/bin/script and refuses to execute it as a shell script:

$ touch xxyzzyz script
$ ksh xxyzzyz
$ ksh ./script
$ ksh script
ksh: script: cannot execute

Bash 2.03 has a bug when invoked with the -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 backslash:

$ $ bash -c 'echo foo \
> '
bash: -c: line 2: syntax error: unexpected end of file
$ bash -c 'echo foo \
>  '
foo

See Backslash-Newline-Empty, for how this can cause problems in makefiles.