From owner-freebsd-stable@FreeBSD.ORG Sun Jul 19 20:44:59 2009 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFC691065672 for ; Sun, 19 Jul 2009 20:44:59 +0000 (UTC) (envelope-from romain@blogreen.org) Received: from marvin.blogreen.org (unknown [IPv6:2a01:e35:2f7d:58c0:0:2:1:2]) by mx1.freebsd.org (Postfix) with ESMTP id 962258FC15 for ; Sun, 19 Jul 2009 20:44:59 +0000 (UTC) (envelope-from romain@blogreen.org) Received: by marvin.blogreen.org (Postfix, from userid 1001) id CB9685C8FA; Sun, 19 Jul 2009 22:44:58 +0200 (CEST) Date: Sun, 19 Jul 2009 22:44:58 +0200 From: Romain =?iso-8859-1?Q?Tarti=E8re?= To: Glen Barber Message-ID: <20090719204458.GD85228@blogreen.org> References: <20090719202638.GA85228@blogreen.org> <4ad871310907191332r2f933a33l36c121903bc0742f@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C+ts3FVlLX8+P6JN" Content-Disposition: inline In-Reply-To: <4ad871310907191332r2f933a33l36c121903bc0742f@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key: http://romain.blogreen.org/pubkey.asc Cc: stable@freebsd.org Subject: Re: Value of $? lost in the beginning of a function. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jul 2009 20:45:00 -0000 --C+ts3FVlLX8+P6JN Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Glen, On Sun, Jul 19, 2009 at 04:32:28PM -0400, Glen Barber wrote: > > % sh foo.sh > > % zsh foo.sh > > % bash foo.sh > What happens if you replace '#!/bin/sh' with '#!/usr/local/bin/zsh' ? This is not related to my problem since I am not running the script using ./foo.sh but directly using the proper shell. sh just behaves differently, that looks odd so I would like to know if it is a bug in sh or if there is no specification for this and the behaviour depends of the implementation of each shell, in which case I have to tweak the script I am porting to avoid this construct (passing $? as an argument for example). Romain --=20 Romain Tarti=E8re http://romain.blogreen.org/ pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43) (plain text =3Dnon-HTML=3D PGP/GPG encrypted/signed e-mail much appreciated) --C+ts3FVlLX8+P6JN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkpjhcoACgkQ2OmjP/9W/0OLjQCglgVSeWg+91JafIyhPbN8guze P7AAnRqlAxiHDfOcNCxcpf5uOWd3ANHG =axht -----END PGP SIGNATURE----- --C+ts3FVlLX8+P6JN--