shell in programs

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Thu Jan 17 12:38:54 AEST 1991


In article <5302 at auspex.auspex.com> guy at 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 at jpl-devvax.jpl.nasa.gov



More information about the Comp.unix.questions mailing list