Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49972 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86510 invoked from network); 26 Oct 2010 11:00:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Oct 2010 11:00:24 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:62670] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/29-35365-7C4B6CC4 for ; Tue, 26 Oct 2010 07:00:24 -0400 Received: by qwj8 with SMTP id 8so2521420qwj.29 for ; Tue, 26 Oct 2010 04:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:reply-to :in-reply-to:references:from:date:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=ZGY2ejGMrRGuNxMSXjjllsCcJYorrIgcBw+McxlGyow=; b=vXRma588nlEsBt4vpB8ScCXQIuiN137SwcRp/PwHvbJ81jPo1KHCYeBmDOiG/XEceZ PoJSKOJuy4CaE4oi5ZhYoZ79M0ahoSxgp1u5Wjc0AJCZAN/KAgecXINxxG8Wpl98ZqRZ E9MfVeBGS3xpJBFnI3yOTxPD5dugJyZl3delg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=me+fXZzkmrVg9X6gLyfJ4FLO3gCRHEI1VDqghXnjKUhaHtxxCkjwpoWBInJGEEvRGn RvVZ8nRhuhnUQc2cy75LJWnecB0Abt7DKcfqZrkNTOgUxTAL9EsqLXOTAqkPxEcgOxJS wV/LjsGoQ88bx1LbkUBiy8VmJrBtbs1BJznE0= Received: by 10.229.248.79 with SMTP id mf15mr7436409qcb.181.1288090819512; Tue, 26 Oct 2010 04:00:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.21.201 with HTTP; Tue, 26 Oct 2010 03:59:59 -0700 (PDT) Reply-To: RQuadling@googlemail.com In-Reply-To: <1288081757.2598.11.camel@lenny> References: <1288081757.2598.11.camel@lenny> Date: Tue, 26 Oct 2010 11:59:59 +0100 Message-ID: To: John Carter Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Inconsistent exit code from CLI? From: rquadling@gmail.com (Richard Quadling) On 26 October 2010 09:29, John Carter wrote: > Hi, > > When php is invoked from the command line with -h we get exit code 0 as > expected: > > -bash-3.2# php -h ; echo $? > Usage: php [options] [-f] [--] [args...] > =C2=A0 =C2=A0 =C2=A0 php [options] -r [--] [args...] > =C2=A0 =C2=A0 =C2=A0 php [options] [-B ] -R [-E ] [--] > [args...] > ... > =C2=A0--re =C2=A0 =C2=A0 =C2=A0Show information about extension . > =C2=A0--ri =C2=A0 =C2=A0 =C2=A0Show configuration for extension . > > 0 > > However if we use (what I understand to be an) invalid option we also > get 0: > > php -Z ; echo $? > Usage: php [options] [-f] [--] [args...] > .... > 0 > > I've checked a couple of other tools (ls and grep) and they return exit > code 2 when the options aren't recognised. > > Found on 5.2.14 and 5.3.3. > > Thanks, > > John. Using windows ... @ECHO OFF ECHO Calling PHP -v PHP -v ECHO %ERRORLEVEL% ECHO Calling PHP -j PHP -j ECHO %ERRORLEVEL% Both errorlevels are 0. --=20 Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY