delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/19/10:31:44

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
To: cygwin AT cygwin DOT com
From: David Kramer <david AT thekramers DOT net>
Subject: pdksh not setting $? with exit status of commands
Date: Wed, 19 Jan 2005 15:20:12 +0000 (UTC)
Lines: 30
Message-ID: <loom.20050119T161314-452@post.gmane.org>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 68.166.51.238 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3)
X-IsSubscribed: yes

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.  

In pdksh:
/c/windevel> grep o regexps
oo
/c/windevel> echo $?
0
/c/windevel> grep Z regexps
/c/windevel> echo $?
0

In bash:
/c/windevel> grep o regexps
oo
/c/windevel> echo $?
0
/c/windevel> grep Z regexps
/c/windevel> echo $?
1

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.

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.

Thanks.



--
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