On Wednesday 25 February 2004, johnm at rte.ie (John Moylan) wrote:
>Use && instead of ;
>with && a command will only run after the first command has succeeded.
>>date && time oggdec -o 123.wav dante.ogg && date
That makes no difference at all provided the time command doesn't fail,
which it won't.
But I suspect I've put my finger on it - the fast box I was testing on
is a dual HT Xeon. I expect
command_A; command_B; command_C
to do those commands, in that order, starting one after the other has
finished. But maybe on such a box scheduling happens differently.
TBH I don't see how - it seems it would break shell semantics. And it
doesn't seem to work like that. For instance,
date; sleep 2; sleep 2; sleep 2; date
shows the expected 6 second elapsed time. But yet when I do
date ;touch X1; time oggdec -o 123.wav dante.ogg ;touch X2; date
the output of the date commands and the time commands and of
ls --full-time X? shows me that the oggdec took about 1 second -
despite the fact that more wallclock time has definitely elapsed.
This is well weird.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!