On Thu, Mar 10, 2016 at 10:33:15AM -0600, John McKown wrote:
> I appreciate the information. I was afraid that my tests were too
> simplistic. What triggered this was my starting to learn the GO language,
> which has a "defer" command. You can "defer" any number of commands and
> they will execute, in LIFO order, when the function in which they were
> executed ends, however that is: panic, return, or "fall off the end".
> Somewhat akin, conceptually, to thethe C language "on_exit()" or "atexit()"
> ability. I was trying for something similar in a script.
The analogous bash construct is an EXIT trap.
trap 'rm -f -- "$temp1"' EXIT