This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pdksh not setting $? with exit status of commands

On Wed, 19 Jan 2005, David Kramer wrote:

> When I execute commands in the pdksh shell that should set an exit
> value, $? is not being set.  When I use the bash shell, it is.

Please review and follow <> to provide
enough information about your installation.

> In pdksh:
> /c/windevel> grep o regexps
> oo
> /c/windevel> echo $?
> 0
> /c/windevel> grep Z regexps
> /c/windevel> echo $?
> 0
> [snip bash session]
> Grep is just one command I'm using for demonstration.  This is true of
> all commands I've tried so far.  Even when I write my own script and
> exit 1 from it, $? is zero afterwards, which is really hurting my
> automation efforts.

Can't reproduce this here, sorry:

$ pdksh
$ cygcheck -f /bin/pdksh
$ grep o regexps ; echo $?
$ grep Z regexps ; echo $?

> Oh, and I have to use a ksh-like shell, because the same scripts need to
> run on an AIX box with ksh and no bash.

Well, this seems to be a problem with your Cygwin installation, but that
aside, using bourne-shell syntax should work for both bash and ksh.

Igor Pechtchanski, Cygwin volunteer PDksh maintainer
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]