I have a script that writes temporary files to help in its execution. At the end of my script, I just call the rm filenametemp files I created to clean up. The problem is that the script ends due to an error or is interrupted. In these cases, the statement is rmnever reached, and therefore the files are never cleared. Is there a way to tell some command to run on exit, regardless of whether it was a successful exit?
source
share