Path: utzoo!attcan!uunet!lll-winken!ames!hc!lanl!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.unix.questions Subject: Re: Line at a time scripts in csh Message-ID: <9511@smoke.BRL.MIL> Date: 26 Jan 89 23:49:41 GMT References: <4116@paris.ics.uci.edu> <909@ubu.warwick.UUCP> <7296@ihlpf.ATT.COM> <872@auspex.UUCP> <7372@ihlpf.ATT.COM> <891@auspex.UUCP> <7449@ihlpf.ATT.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 18 In article <7449@ihlpf.ATT.COM> lukas@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.