Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Mar 2011 18:10:28 -0430
From:      Andres Perera <andres.p@zoho.com>
To:        Maxim Khitrov <max@mxcrypt.com>
Cc:        Devin Teske <dteske@vicor.com>, FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: Shell script termination with exit function in backquotes
Message-ID:  <AANLkTim0GvnAyK3%2B=Bd1Sr=maz0B3Ybgve_c6FKWwfNs@mail.gmail.com>
In-Reply-To: <AANLkTimrnV2rJLyc3M4e3gGy_GUDLXp128f6n8svM3_g@mail.gmail.com>
References:  <AANLkTi=-CFmxRicGcosvzhBbM3DMjbWwQNirMrJ1_KP=@mail.gmail.com> <759A467E-407A-4DB8-9756-08011B5405F0@vicor.com> <AANLkTi=CXLFUBhnY1LuhkeUiGHHGZ43yd%2BMYE9L50_O4@mail.gmail.com> <AANLkTimrnV2rJLyc3M4e3gGy_GUDLXp128f6n8svM3_g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 14, 2011 at 7:46 AM, Maxim Khitrov <max@mxcrypt.com> wrote:
> On Mon, Mar 14, 2011 at 3:16 AM, Andres Perera <andres.p@zoho.com> wrote:
>> On Sun, Mar 13, 2011 at 9:49 PM, Devin Teske <dteske@vicor.com> wrote:
>>> If you make the changes that I've suggested, you'll have consistent exe=
cution. The reason you're having inconsistent behavior is because Linux has=
 /bin/sh symbolically linked to /bin/bash while FreeBSD has a more traditio=
nal shell (we'll call it bourne shell "plus").
>>
>> that is misleading because command substitutions have traditionally
>> invoked subshells, and freebsd sh(1)/ash is an exception, not the norm
>>
>> in this case, ksh and bash deviates are clearly closer to standard
>> bourne behaviour
>>
>
> Thanks for that explanation. I can understand the benefits of
> optimizing away subshell execution, but that can clearly lead to
> unexpected behavior. Is there some documentation on when this
> optimization is utilized (i.e. the command executed without a
> subshell)? Would I be correct in assuming that it is only restricted
> to built-in commands that are known not to produce any output, such as
> 'exit'?

i would check the source, autoconf docs, and http://www.in-ulm.de/~mascheck=
/

netbsd has  been patched to fix `exit 1`, according to the last site

>
> - Max
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim0GvnAyK3%2B=Bd1Sr=maz0B3Ybgve_c6FKWwfNs>