#!/bin/bash
function finish {
  # Your cleanup code here
}
trap finish EXIT