delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/19/15:16:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 19 Jan 2005 15:15:53 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: David Kramer <david AT thekramers DOT net>
cc: cygwin AT cygwin DOT com
Subject: Re: pdksh not setting $? with exit status of commands
In-Reply-To: <loom.20050119T161314-452@post.gmane.org>
Message-ID: <Pine.GSO.4.61.0501191509070.20608@slinky.cs.nyu.edu>
References: <loom DOT 20050119T161314-452 AT post DOT gmane DOT org>
MIME-Version: 1.0

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 <http://cygwin.com/problems.html> 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
pdksh-5.2.14-3
$ grep o regexps ; echo $?
oo
0
$ grep Z regexps ; echo $?
1

> 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
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,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:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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