Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.questions Subject: Re: shell in programs Message-ID: <11085@jpl-devvax.JPL.NASA.GOV> Date: 17 Jan 91 01:38:54 GMT References: <346@bria> <5236@auspex.auspex.com> <371@ddmt.dla.mil> <5302@auspex.auspex.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Distribution: na Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 17 In article <5302@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: : >Another advantage to *not* using system() is : > "There is an enormous amount of overhead associated with each system : > call. The starting program has to fork and exec the shell, and then : > the shell has to fork and exec the requested program..." [1] : : Yes, but if the person wants to run an arbitrary shell command - and : that's what it sounded like the original poster wanted to do - you have : to run the shell anyway (or precisely duplicate its actions, which seems : like a waste). One typical tradeoff is to use the shell if the command contains any shell metacharacters, and execute the program directly otherwise. Perl and many make programs do this. Larry Wall lwall@jpl-devvax.jpl.nasa.gov