Skip to content

Instantly share code, notes, and snippets.

@dwallraff
Created September 13, 2016 16:53
Show Gist options
  • Save dwallraff/512c06bd70d8bb7b439a3478b643c4bc to your computer and use it in GitHub Desktop.
Save dwallraff/512c06bd70d8bb7b439a3478b643c4bc to your computer and use it in GitHub Desktop.
Trap EXIT in a bash script
#!/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