Re: wrong logical evaluation of expressions involving true or false commands

2007-06-25 Thread Paul Jarc
Matthew Woehlke <[EMAIL PROTECTED]> wrote: > Stephane Chazelas wrote: >> [ -n "$foo" -a -n "$bar" ] >> is not the expression to test whether both "$foo" and "$bar" are >> non-empty, as it would fail for some specific values of $foo or >> $bar (try it when $foo contains "=" for instance). > > Huh? W

Re: wrong logical evaluation of expressions involving true or false commands

2007-06-25 Thread Matthew Woehlke
Stephane Chazelas wrote: And it should be noted (and it's noted as well in the page you're refering to) that while the above is true for strings such as "foo" and "bar", it is not true in the general case. [ -n "$foo" -a -n "$bar" ] is not the expression to test whether both "$foo" and "$bar" a

Re: wrong logical evaluation of expressions involving true or false commands

2007-06-25 Thread Stephane Chazelas
On Mon, Jun 25, 2007 at 02:07:56PM -0600, Bob Proulx wrote: [...] > following. These are the same. > > [ foo -a bar ] > [ -n foo -a -n bar ] > > This is defined by standard by the number of arguments. > > http://www.opengroup.org/onlinepubs/009695399/utilities/test.html [...] And it shou

Re: wrong logical evaluation of expressions involving true or false commands

2007-06-25 Thread Bob Proulx
Miguel Ángel wrote: > Evaluating expressions like: > [ true -a false ] ; echo $? > always returns 0 (true), doesn't mind if I change true for false or > viceversa. In the case of the test operator (aka '[ expr ]') use of "true" and "false" as you have done are strings and not boolean expressions a

RE: wrong logical evaluation of expressions involving true or falsecommands

2007-06-25 Thread Andrew Neitsch
'help test' says that an expression consisting of a single string is an alias for "-n STRING" which is "true if the string is not empty." So, [ false -a false ] and [ false ] are true because "false" is a non-empty string. [ "" ] is false. You probably just want 'true && false' without the [.

wrong logical evaluation of expressions involving true or false commands

2007-06-25 Thread Miguel Ángel
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='p$ uname output: Linux hal 2.6.20-16-generic #2 SM

no error detection for process substitution

2007-06-25 Thread markd
Configuration Information [Automatically generated, do not change]: Machine: amd64 OS: freebsd6.2 Compiler: cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='amd64' -DCONF_OSTYPE='freebsd6.2' -DCONF_MACHTYPE='amd64-portbld-freebsd6.2' -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/

no error detection for command substitution

2007-06-25 Thread markd
Configuration Information [Automatically generated, do not change]: Machine: amd64 OS: freebsd6.2 Compiler: cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='amd64' -DCONF_OSTYPE='freebsd6.2' -DCONF_MACHTYPE='amd64-portbld-freebsd6.2' -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/