Le 12/10/2013 18:27, Dan McGhee a écrit :
> 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?
> 
> Thanks,
> Dan

Well, dunno if this is rant, recommandation or comment, but you should have a 
look
at the paragraph about "Lists" in the bash manpage.
It's all explained there, much better than I would.

But now a rough answer: the meaning of this line is:
change directory to ${HOME}/blah. If that succeeds, set the srcdir variable to 
the
full path to that directory. If either of the preceding commands fails then 
exit with error code.

Regards
Pierre
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to