Dirk Fieldhouse <fieldho...@gmx.net> wrote: > On 15/03/20 16:43, Harald van Dijk wrote: > >...> > > > "Before the shell terminates" is not limited to "before the top level > > shell terminates". If a shell terminates, even if it is a subshell that > > terminates, any EXIT trap action should be run. > > Sure, that is the intended interpretation, but this requirement in the > DESCRIPTION of 'exit' > > "... If the current execution environment is a subshell environment, the > shell shall exit from the subshell environment with the specified exit > status and continue in the environment from which that subshell > environment was invoked; otherwise, the shell utility shall terminate > with the specified exit status. ..." >
--------> The environment in which the shell executes a trap on EXIT shall be identical to the environment immediately after the last command executed before the trap on EXIT was taken. <------- This implies that the exit trap is called from within exit(1), but return(1) does not call exit(1) nor is it an alias for exit(1). 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/'