Created
September 13, 2016 16:53
-
-
Save dwallraff/512c06bd70d8bb7b439a3478b643c4bc to your computer and use it in GitHub Desktop.
Trap EXIT in a bash script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Do some stuff | |
function finish { | |
# Your cleanup code here | |
} | |
trap finish EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment