Line at a time scripts in csh

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Jan 27 09:49:41 AEST 1989


In article <7449 at ihlpf.ATT.COM> lukas at ihlpf.UUCP (00771g-Lukas,J.) writes:
>It failed with messages like you suggested. So, I threw in a
>"ps" into "foo", and found that "csh" forked a "sh" process to actually
>run "foo", and that is why it worked. I guess I didnt expect that.
>Why was a "sh" child produced, instead of another "csh" (or, anyway,
>a "ksh", which is my login shell, and the value of SHELL)? Any ideas?
>Parenthetically, I did the same sort of thing with "ksh" instead of "csh",
>and another "ksh" (NOT a "sh") was forked to run the "ps".

The implementors of your csh should be congratulated for getting this
right (for a change).  csh is supposed to feed scripts to a Bourne shell.
The only exception would be if your kernel doesn't support #! execs but
(ALL) your shells are expected to take care of this, in which case the
#! line should be interpreted and the appropriate processor run to handle
the script.

The Korn shell is supposedly upward-compatible with the Bourne shell, so
it is able to handle scripts directly instead of invoking a separate shell.



More information about the Comp.unix.questions mailing list