bug-bash
[Top][All Lists]
Advanced

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

error in expression evaluation


From: Bernhard Bablok
Subject: error in expression evaluation
Date: Fri, 22 Feb 2008 12:48:01 +0100
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux-gnu
Compiler: 
gcc -I/usr/src/packages/BUILD/bash-3.2 
-L/usr/src/packages/BUILD/bash-3.2/../readline-5.2
Compilation 
CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' -DCONF_OSTYPE='linux-gnu' 
-DCONF_MACHTYPE='i586-suse-linux-gnu' -DCONF_VENDOR='suse' 
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  
-I. -I./include -I./lib   -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall 
-D_FORTIFY_SOURCE=2 -fstack-protector -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall 
-pipe -g -fPIE -fprofile-use
uname output: Linux sirius 2.6.22.9-0.4-default #1 SMP 2007/10/05 21:32:04 UTC 
i686 athlon i386 GNU/Linux
Machine Type: i586-suse-linux-gnu

Bash Version: 3.2
Patch Level: 25
Release Status: release

Description:
The following code produces an error (second if-statement):

#!/bin/bash

if [ '(' != ',' ]; then
   echo "'(' != ',' works :-)"
fi
if [ 'a' != 'b' -a '(' != ',' ]; then
   echo "'a' != 'b' -a '(' != ',' does not work :-("
fi

It seems that the parser does not like the "(" after an "-a" in a compound 
expression.


Repeat-By:
        [Describe the sequence of events that causes the problem
        to occur.]

Fix:
Workaround: don't use a compound expression, use a second if-statement within 
the first if-statement.

Bernhard




reply via email to

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