>> _As an aside_, I noticed there are many script aficionados
>> among (B)LFS users and I suppose the "&&" concept in the
>> book instructions helps them a lot.
>> (command1 &&
>> command2 &&
>> ...)
>> I am one of (or maybe unique among) the people what like to take
>> their time between commands (and append "; echo $?" at the end).

Just to elaborate on some of the comments in this thread:
The && (logical AND) syntax carries with it an implicit condition --
subsequent commands are executed only if previous commands exit
successfully. So in something like "FOO && BAR", if FOO returns an
exit status of zero, then it was successful and BAR will then execute;
otherwise FOO was not successful and BAR will not execute. Any error
messages will be related to why FOO was not successful.
The ; (semicolon) syntax does not imply any checks on command exit
status. Commands are simply executed in sequence, regardless of the
exit status of a previous command (which explains why, in the quoted
comment, the echo command always executes).

So the difference between the two styles in general seems to be
whether a less experienced user will be able to recognize which
command in the list failed. Executing commands one at a time is the
most direct way to validate their exit status. Using lists of commands
AND'ed together is more convenient, but may take a practiced eye to
recognize which command failed.

Again, a difference in style. Both get the job done. So there's not
much reason to fuss too much. O wait ...
~rick
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to