Dirk Fieldhouse <fieldho...@gmx.net> wrote: > On 15/03/20 07:26, Robert Elz wrote: > >...> > >[I wrote:]> | Is there any suggestion that the 'exit'-like > behaviour of any shell that > > | implements it for 'return' in such contexts is subtly different from > > 'exit'? > > > > Not that I am aware of. exit is kind of blunt, it is quite hard to > > be subtly different - I suppose the one difference might be whether the > > EXIT trap (if there is one) is run, ... > >...> > > Unfortunately this brings a differently flavoured can of worms. > > The standard's wording on 'exit' appears to require that the EXIT trap > is run when exiting a top level shell ("before the shell terminates,"), > and not when execution "continue[s] in the environment from which that > subshell environment was invoked" -- which the standard contrasts with > "otherwise, the shell utility shall terminate...".
See my remark about the fact that ksh does not use the same definition of "return" as POSIX. All shells thatdo not claim ksh compatibilits (which is the majority) do not execute the EXIT trap in that case. Jörg -- EMail:jo...@schily.net (home) Jörg Schilling D-13353 Berlin joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'