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) != (!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. > > Is there any way to avoid redundancy in the shell script that needs this? The > code in question is already quite complex, so adding this redundancy makes it > less readable. [...]
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. -- Stéphane _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash