Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!ai-lab!tmb From: tmb@wheaties.ai.mit.edu (Thomas M. Breuel) Newsgroups: gnu.emacs Subject: Re: Why programs use the shell to start up a program Message-ID: <1273@rice-chex.ai.mit.edu> Date: 24 Mar 89 13:05:04 GMT References: <8903231435.AA11955@galaxy.compass.com> Distribution: gnu Organization: MIT AI Lab, Cambridge, MA Lines: 17 In-reply-to: think!compass!worley@EDDIE.MIT.EDU's message of 23 Mar 89 14:35:49 GMT In article <8903231435.AA11955@galaxy.compass.com> think!compass!worley@EDDIE.MIT.EDU (Dale Worley) writes: Generally the Un*x convention is that if a program wants to start an inferior process, it has the shell do it, rather than doing a fork() and exec() itself. See, for example, the system() call. You might well wonder why this is done, since it costs time, and probably sets up an additional process (is that really true?). The reason is that often the "program name" to run is obtained from the user or an environment variable, and using the shell to process it gives additional flexibility. People often complain that making a subshell is slow. This is mostly a function of the kind of shell you are using. Using the Bourne shell (at least for subshells), system() calls and subshells start up almost instantaneously. If you must use the C-shell, you should at least check in your .cshrc whether the shell is run interactively and skip most of the .cshrc file if it is not.