IIRC, make will spawn a shell for the sed command due to to '>' in the command line.  
I believe make will then fork/exec for the mv command.  Since make is already shelling 
out for the sed command, I see no reason not to use that shell to do the
conditional mv as well.

If you're worried about legibility, you could write the rule as:

foo:
        sed ... > /tmp/x  && \
        mv /tmp/x y

HTH,
Noel

Robert Mecklenburg wrote:
> 
> I have often used the shell && operator in commands run from make:
> 
> foo:
>         sed ... > /tmp/x && mv /tmp/x y
> 
> but I am now questioning the value of this.  Obviously, the above mv
> is executed only if sed returns success so it "protects" y from
> accidental clobbering.  However, isn't that exactly what this does:
> 
> foo:
>         sed ... > /tmp/x
>         mv /tmp/x y
> 
> If sed's exit status is non-zero make will not perform the mv -- even
> with the -k flag.  Of course, it will perform the mv with the -i
> flag, but that is virtually never used.
> 
> Assuming the -i flag isn't used (or .SILENT: etc.), is one form
> preferred over the other?  Right now I prefer the second form.
> 
> Comments?
> --
> Robert
> 
> _______________________________________________
> Help-make mailing list
> [EMAIL PROTECTED]
> http://mail.gnu.org/mailman/listinfo/help-make

-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive 
confidentiality or privilege, and use is prohibited.


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to