Value of $? lost in the beginning of a function.
Romain Tartière
romain at blogreen.org
Sun Jul 19 20:26:40 UTC 2009
Hi!
Simple test case:
----8<----------------------
#!/bin/sh
foo()
{
echo "\$?=$? \$1=$1"
}
false
foo $?
----8<----------------------
% sh foo.sh
$?=0 $1=1
% zsh foo.sh
$?=1 $1=1
% bash foo.sh
$?=1 $1=1
As you can see, the value of $? is « lost » when FreeBSD sh enters a
function. Is this supposed to behave this way?
Thanks,
Romain
--
Romain Tartière <romain at blogreen.org> http://romain.blogreen.org/
pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43)
(plain text =non-HTML= PGP/GPG encrypted/signed e-mail much appreciated)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20090719/929bb0cc/attachment.pgp
More information about the freebsd-stable
mailing list