[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using && in commands
From: |
Robert Mecklenburg |
Subject: |
Using && in commands |
Date: |
06 Nov 2003 15:16:13 -0700 |
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
- Using && in commands,
Robert Mecklenburg <=