bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: logical XOR


From: Chet Ramey
Subject: Re: logical XOR
Date: Fri, 29 Jun 2007 15:34:43 -0400
User-agent: Thunderbird 2.0.0.4 (Macintosh/20070604)

Robert Millan [ackstorm] wrote:

>>>     There's bitwise AND and bitwise OR, and logical AND and logical OR, but
>>>     for XOR there's only the bitwise version.  Would be nice if the logical
>>>     XOR would also be present (^^).
>> (!a) != (!b)
>>
>> should work acceptably for the situations such an operator would be used.
> 
> I'm not sure what you mean.  The following:
> 
>       (true && ! false) || (false && ! true)
>       echo $?
> 
> works, whereas the following:
> 
>       (! true) != (! false)
>       echo $?
> 
> shows syntax error.

That really doesn't have anything to do with the issue.  The original
question concerned the arithmetic operators accepted by the expression
evaluator, not the shell language.

>> The reason it's not there is because it's not in C.
> 
> Because of performance?

Because bash implements a subset of C's arithmetic language (with one
exception), and C doesn't have a logical XOR operator.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]