Re: logical XOR

2007-06-29 Thread Chet Ramey
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 su

Re: logical XOR

2007-06-29 Thread Stephane Chazelas
On Fri, Jun 29, 2007 at 12:08:22PM +0200, Robert Millan [ackstorm] wrote: > On Fri, Jun 29, 2007 at 10:16:18AM +0100, Stephane Chazelas wrote: > > > > Do you mean that for instance, you'd like a third command to be > > executed if either but not both of two commands succeed? > > > > cmd1; a=$? >

Re: logical XOR

2007-06-29 Thread Andreas Schwab
"Robert Millan [ackstorm]" <[EMAIL PROTECTED]> writes: > I'm not sure what you mean. The following: > > (true && ! false) || (false && ! true) > echo $? > > works, whereas the following: > > (! true) != (! false) > echo $? > > shows syntax error. true and false are not nu

Re: logical XOR

2007-06-29 Thread Robert Millan [ackstorm]
On Fri, Jun 29, 2007 at 10:16:18AM +0100, Stephane Chazelas wrote: > > Do you mean that for instance, you'd like a third command to be > executed if either but not both of two commands succeed? > > cmd1; a=$? > cmd2; b=$? > (( !a != !b )) && cmd3 > > should do. Thank you, that works. Although

Re: logical XOR

2007-06-29 Thread Stephane Chazelas
On Fri, Jun 29, 2007 at 10:21:01AM +0200, 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) != (!

Re: logical XOR

2007-06-29 Thread Robert Millan [ackstorm]
On Thu, Jun 28, 2007 at 06:58:25PM -0400, Chet Ramey wrote: > ackstorm wrote: > > Configuration Information [Automatically generated, do not change]: > > Machine: i486 > > OS: linux-gnu > > Compiler: gcc > > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' > > -DCONF_OSTYPE='linux-gnu'

Re: logical XOR

2007-06-28 Thread Chet Ramey
ackstorm wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/u