[lfs-support] Possible Syntax Error in Current "Package User" Hint Build Script

Dan McGhee beesnees at grm.net
Sat Oct 12 09:27:43 PDT 2013

I'm melding my build script to the current one from this hint.  I've 
found a possible syntax error and want to see if my thinking is 
correct.  Since I've been monitoring this list closely again, i.e.; the 
last three weeks, I've not seen anyone who has had a problem running 
this script.  But I think that few people build this way. :)

Here is the line in question:

cd "$HOME/xxxbuild/yyysrc" && srcdir="$(pwd)" || exit 1

This patter occurs a number of times in the script and, therefore, I 
think it's important.  For this question the references to what actually 
exist are not relevant.  It's only the syntax.  In attempting to 
understand what this statement is doing, I've come up with this plain 
language interpretation.

"Change to the package build directory IF AND ONLY IF the package source 
directory is the same as the current directory OR exit with a status of 1."

In typing this I've also generated a question about the "'s, but it's 
the use of the logical operators, which I've capitalized, that has my 
attention.  Here's the question:

If <&&> and <||> are logical operators, shouldn't the whole command be 
enclosed in double brackets,
[[ command1 && command2 || command3 ]]? The other syntax I know would be
[ command1 -a command2 -o command3 ].

Of course, this is all predicated on the use of <&&> and <||> as logical 
operators.  But if they're not, I don't understand the command.

Comments? Answers? Recommendations? Rants?


More information about the lfs-support mailing list