bug-bash
[Top][All Lists]
Advanced

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

bash fails if-then test when enclosing negated test command in parenthes


From: p . stansell
Subject: bash fails if-then test when enclosing negated test command in parentheses
Date: Mon, 18 Jun 2001 14:47:30 +0100

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H  -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64  -I.  -I. -I./include -I./lib -I/usr/include -O2 
-march=i386 -mcpu=i686
uname output: Linux outsider.civ.hw.ac.uk 2.4.2-2 #1 Sun Apr 8 19:37:14 EDT 
2001 i586 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.04
Patch Level: 21
Release Status: release

Description:
This bash shell is not behaiving the same way as other versions I have
tested.  In particular the "if" command is failing to recognise the negation
of the if-test when the if-test is placed in parentheses and negated with "!".

Repeat-By:
Write the following text to a file called tmp.sh:

#--------------------start of tmp.sh---------------------------
echo hello > tmp.in

if ( ! grep hello tmp.in > /dev/null )
then
  echo test failed
else
  echo test succeeded
fi

#--------------------end of tmp.sh---------------------------

Now issue the command "bash tmp.sh" at the command prompt.

The actual output is

  test failed

but the expected output is

  test succeeded



reply via email to

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