#!/bin/bash
#  cleanup - cleanup functioin handling

set -e


######
# Settings

lib_setting_arrays cleanup_funcs


######
# Functions

cleanup_init() {
	trap cleanup_exec EXIT
}

cleanup_add() {
	has_args 1 "$@"
	list_append cleanup_funcs "$1"
}

cleanup_exec() {
	for f in "${cleanup_funcs[@]}"; do
		$f
	done
}

View the Script Reference Index


Generated on Tue Apr 25 21:20:02 PDT 2017 by mcsh i7 v0.18.0.