Bug 44848 - bash fails if-then test when enclosing test command in parentheses
bash fails if-then test when enclosing test command in parentheses
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.1
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-18 09:20 EDT by Paul Stansell
Modified: 2007-04-18 12:33 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-18 09:20:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Paul Stansell 2001-06-18 09:20:00 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i586; Nav)

Description of problem:
The bash shell is not behaiving the same way as other versions I have
testes.  In particular the if-then in failing to recognise the negation of
the if-test when the if-test is places in parentheses and negated with "!".

How reproducible:
Always

Steps to Reproduce:
1. Write the following text to a file called tmp.sh:

echo hello > tmp.in

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

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

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

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

2. Issue command "bash tmp.sh" at prompt.
3.
	

Actual Results:  test failed
test failed
test failed
test succeeded


Expected Results:  test failed
test succeeded
test failed
test succeeded


Additional info:
Comment 1 Bernhard Rosenkraenzer 2001-06-26 06:40:44 EDT
Fixed in 2.05-5 and higher.

Note You need to log in before you can comment on or make changes to this bug.