Bug 20349 - Not (!) not working ?
Summary: Not (!) not working ?
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-11-05 02:14 UTC by Need Real Name
Modified: 2007-04-18 16:29 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-11-05 02:14:53 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2000-11-05 02:14:51 UTC
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 09:08:31 UTC
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.