different behaviour of bash and sh

Andrej Borsenkow Andrej.Borsenkow@mow.siemens.ru
Fri Mar 9 06:36:00 GMT 2001


On Fri, 9 Mar 2001, Earnie Boyd wrote:

> In the Cygwin release
>
> sh != bash
> sh == ash
>


So what? The question is, if the exibited behaviour of *sh* is correct;
the question was not "if sh is bash".

IMHO that is a bug in sh (or ash if you insist). The 'echo $?' is the next
command executed after 'false' - so , there is nothing that can change the
value of '$?' in between.

-andrej

> Earnie.
>
> Ralf Fassel wrote:
> >
> > Configuration Information [Automatically generated, do not change]:
> > Machine: i686
> > OS: cygwin
> > Compiler: gcc
> > Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H   -I.  -I../src -I../src/include -I../src/lib -I/src/bash/distro/usr/include -g -O2
> > uname output: CYGWIN_NT-4.0 MARS 1.1.8(0.34/3/2) 2001-01-31 10:08 i686 unknown
> > Machine Type: i686-pc-cygwin
> >
> > Bash Version: 2.04
> > Patch Level: 7
> > Release Status: release
> >
> > Description:
> > The following script behaves differently in bash and sh:
> >
> >     % cat script
> >     #!/bin/sh --
> >     checkstat() {
> >         echo $?
> >     }
> >     false
> >     checkstat
> >     # End of file
> >
> > Repeat-By:
> >
> >     $ type bash
> >     bash is /usr/bin/bash
> >     $ bash script
> >     1
> >     $ type sh
> >     sh is /usr/bin/sh
> >     $ sh script
> >     0
> >
> > The 0 is wrong IMHO, it should be 1.  (Even HP with their BD-/bin/sh
> > returns 1).
> >
> > R'
> >
> > --
> > Want to unsubscribe from this list?
> > Check out: http://cygwin.com/ml/#unsubscribe-simple
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
>
>

-- 
------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 737 2747
Siemens ICP ITS Moscow		Tel:   +7 (095) 737 2723

E-Mail: Andrej.Borsenkow@mow.siemens.ru
-------------------------------------------------------------------------


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list