bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The trap EXIT not allways executed


From: L. A. Walsh
Subject: Re: The trap EXIT not allways executed
Date: Tue, 08 Nov 2016 11:27:17 -0800
User-agent: Thunderbird


FYI: This works in 4.3.42 (echos "ATT: execute trap function" in both).

Dr. Werner Fink wrote
The trap EXIT not allways executed, see example script

Repeat-By:
Example script
----------------------------------------------------------------
#!/bin/bash
bash -c '
_rm () { echo ATT: Execute trap function; }
trap _rm EXIT
rm -f doesnotexist
'
echo $?

bash -c '
_rm () { echo  ATT: Execute trap function; }
rm -f doesnotexist
trap _rm EXIT
'
echo $?
----------------------------------------------------------------

which results in

----------------------------------------------------------------
0
ATT: Execute trap function
0
----------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]