Donnie Berkholz wrote:
> On 08:58 Mon 01 Oct     , Alin Năstac wrote:
>   
>> According to bash manual, && has a greater precedence than ||. That
>> would translate in:
>>     
>
> Where'd you see that? Here's my man page:
>
>        A  list  is a sequence of one or more pipelines separated by one of the
>        operators ;, &, &&, or ||, and optionally terminated by one of ;, &, or
>        <newline>.
>
>        Of these list operators, && and || have equal precedence, followed by ;
>        and &, which have equal precedence.
>
> Oh, now I see. You're reading about precedence in [[ ]] blocks, which 
> aren't being used here.
>
>   

OK, I misread the manual, but even if && and || have same precedence,
bash manual says:
       The control operators && and || denote AND lists and OR lists,
respectively.  An AND list has the form
              command1 && command2
       command2 is executed if, and only if, command1 returns an exit
status of zero.
       An OR list has the form
              command1 || command2
       command2 is executed if and only if command1 returns a non-zero
exit status.  The return status of AND and OR lists is the exit status
of the  last  com-
       mand executed in the list.

In this case, $(use mysql || use postgres && use_enable virtual-users)
will result in use_enable virtual-users being executed if and only if
USE="-mysql postgres". See this pseudocode:
    if use mysql do nothing
    else if use postgres
          use_enable virtual

Wouldn't be best to die in pkg_setup if USE="virtual-users -mysql
-postgres" ?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to