Value of $? lost in the beginning of a function.

Romain Tartière romain at blogreen.org
Sun Jul 19 20:45:00 UTC 2009


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

-- 
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/fdd0cf0e/attachment.pgp


More information about the freebsd-stable mailing list