#!/bin/bash scratch=$(mktemp -d -t tmp.XXXXXXXXXX) function finish { rm -rf "$scratch" } trap finish EXIT