Bug 20349 - Not (!) not working ?
Not (!) not working ?
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-11-04 21:14 EST by Need Real Name
Modified: 2007-04-18 12:29 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-11-04 21:14:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2000-11-04 21:14:51 EST
my redhat 7.0 system does this
bash-2.04$ if (  /bin/true ) ; then echo ok ;fi
ok
bash-2.04$ if ( ! /bin/true ) ; then echo ok ;fi
ok
bash-2.04$ if (  /bin/false ) ; then echo ok ;fi
bash-2.04$ if ( ! /bin/false ) ; then echo ok ;fi


while my redhat 6.2 and solaris systems do this

bash$  if (  /bin/true ) ; then echo ok ;fi
ok
bash$ if ( ! /bin/true ) ; then echo ok ;fi
bash$ if (  /bin/false ) ; then echo ok ;fi
bash$ if ( ! /bin/false ) ; then echo ok ;fi
ok

Maybe this isn't a bug.  I figured it's probably me who is confused,
because I didn't see an update for this.  I mean, if it really is *that*
broken then scripts all over the world would be breaking...

So what am i doing wrong?
Comment 1 Bernhard Rosenkraenzer 2000-11-05 04:08:31 EST
It's not a bug - it's a POSIX compliant change in bash 2.x.

( ) gets a separate process space.

The right thing to do is keeping everything in the same space:

if /bin/true; then echo ok; fi
ok
if ! /bin/true; then echo ok; fi
if /bin/false; then echo ok; fi
if ! /bin/false; then echo ok; fi
ok

or to use brackets (if [ ! /bin/true ]; then echo ok; fi).


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