delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/07/23/17:20:46

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <397B5CE7.64B5954@phekda.freeserve.co.uk>
Date: Sun, 23 Jul 2000 22:00:23 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Bug in bash 2.03's handling of compound commands?
References: <3979ECC8 DOT 18313 DOT E9FC7 AT localhost>
Reply-To: djgpp-workers AT delorie DOT com

This is a multi-part message in MIME format.
--------------EC414548B5A5C12101E5371B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello.

"Mark E." wrote:
> 
> I wrote:
>
> > I think there may be a bug in bash 2.03's handling of compound
> > commands. For instance, if 'bob' does not exist, then you'd expect $?
> > to be set to 127 after trying to execute it. However, I found the
> > following:
> >
> > DJGPP: "(bob); echo $?" -> 0 displayed
> > Linux: "(bob); echo $?" -> 127 displayed
> >
> 
> Hmm,
> I get 127 from this snippet with both Bash 2.03 and Bash 2.04.

It turned out that I was actually using bash 1.14.7. I upgraded to bash
2.03 and retested. The above commands work correctly in interactive mode
under bash 2.03, unlike under bash 1.14.7. However, compound commands
don't seem to work correctly in scripts. If I run the attached script,
testcomp.sh, I get the following output:

    bash-2.03$ ./testcomp.sh
    + bob
    ./testcomp.sh: bob: command not found
    + echo 127
    127
    + echo 0
    0
    + set +x

This happens with $SHELL set to C:\WINDOWS\COMMAND.COM or
c:\djgpp\bin\bash.exe.

Bye,

-- 
Richard Dawe
[ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]
--------------EC414548B5A5C12101E5371B
Content-Type: application/x-sh;
 name="testcomp.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="testcomp.sh"

#! /bin/sh

set -x
(bob; echo $?)
echo $?
set +x

--------------EC414548B5A5C12101E5371B--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019