Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jul 2009 22:26:38 +0200
From:      Romain =?iso-8859-1?Q?Tarti=E8re?= <romain@blogreen.org>
To:        stable@FreeBSD.org
Subject:   Value of $? lost in the beginning of a function.
Message-ID:  <20090719202638.GA85228@blogreen.org>

next in thread | raw e-mail | index | archive | help

--VbJkn9YxBvnuCH5J
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi!

Simple test case:

----8<----------------------
#!/bin/sh
foo()
{
  echo "\$?=3D$? \$1=3D$1"
}
false
foo $?
----8<----------------------

% sh foo.sh
$?=3D0 $1=3D1
% zsh foo.sh
$?=3D1 $1=3D1
% bash foo.sh
$?=3D1 $1=3D1

As you can see, the value of $? is =AB lost =BB when FreeBSD sh enters a
function.  Is this supposed to behave this way?

Thanks,
Romain

--=20
Romain Tarti=E8re <romain@blogreen.org>        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)

--VbJkn9YxBvnuCH5J
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkpjgX4ACgkQ2OmjP/9W/0O9QACgkZizpSZ0b1ob7W8m+GDa8+5p
js0An1LmFZ+hBCWiFe+LmVIkh1LGm2o2
=2Qr+
-----END PGP SIGNATURE-----

--VbJkn9YxBvnuCH5J--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090719202638.GA85228>