[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sh.exe running twice per job

From: Paul D. Smith
Subject: Re: sh.exe running twice per job
Date: Sat, 27 Mar 2004 22:40:25 -0500

%% "J. Grant" <address@hidden> writes:

  jg> on the 27/03/04 18:16, Earnie Boyd wrote:
  >> J. Grant wrote:

  >>> Why does sh.exe need to run twice?

  >> Because that is the way bash works?  sh.exe -c starts sh as
  >> a parent process and the child sh executes the script.

  jg> Do you know how the first sh.exe passes script to the child
  jg> process in that case out of interest?

I didn't understand your question :-(

A command like this:

    sh -c ''

will invoke two shells: the first one that gets a command line to run
and the command line is "".  Then is invoked, which is
itself a shell script and presumably begins with:


and so another shell is invoked to run the shell script.

This is how the shell works; it's not related to make at all.

  jg> (The child sh.exe does not have any arguments.)  Seems a little
  jg> excessive, but I doubt any extra overhead of this extra
  jg> intermediary process is noticeable in general use.  It appears to
  jg> me like the parent sh.exe just uses the child sh.exe to launch the
  jg> final process.  Not sure why it does not just launch it directly
  jg> though.

GNU make _will_ launch it directly unless it determines that the command
line needs a shell to interpret.  For example, if the command to be run
contains redirection, or it runs multiple commands, or whatever.

In UNIX at least, a command like the one above won't run "sh -c
''"; it will just run directly.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]