%% Robert Mecklenburg <[EMAIL PROTECTED]> writes:

  rm> I have often used the shell && operator in commands run from make:
  rm> foo:
  rm>   sed ... > /tmp/x && mv /tmp/x y

  rm> but I am now questioning the value of this.  Obviously, the above
  rm> mv is executed only if sed returns success so it "protects" y from
  rm> accidental clobbering.  However, isn't that exactly what this
  rm> does:

  rm> foo:
  rm>   sed ... > /tmp/x
  rm>   mv /tmp/x y

  rm> Assuming the -i flag isn't used (or .SILENT: etc.), is one form
  rm> preferred over the other?  Right now I prefer the second form.

In the case you give above they are equivalent.  In fact I don't use &&
there.  But in cases like this they are not equivalent:

    foo:
        cd foo && $(MAKE)

Or even something like:

    foo:
        for x in $(LISTOFSTUFF); do \
            something && somethingelse ; \
        done


In other words, I use "&&" when I need everything to run in the same
shell script, and multiple lines where it doesn't.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


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

Reply via email to