Ready to be published? LXer is read by around 350,000 individuals each month, and is an excellent place for you to publish your ideas, thoughts, reviews, complaints, etc. Do you have something to say to the Linux community?
In this tutorial we explain how to use the trap bash builtin to exit bash scripts cleanly. We explore examples of how to clean up temp files, ensure services stay running and close ports.