Subversion Repositories programming

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
367 ira 1
#!/bin/bash
2
 
3
# Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
4
# License:
5
 
6
# Do not allow usage of unset variables
7
set -o nounset
8
 
9
# Do not allow errors to keep going, exit immediately
10
# Disable with: set +e
11
# Re-enable with: set -e
12
set -o errexit
13
 
14
TEMP_FILE="$(mktemp)"
15
 
16
function clean_up {
17
	# Perform anything that needs to be done when we exit,
18
	# whether or not the exit was a clean one.
19
	# NOTE: the first parameter will be the exit status.
20
	rm "${TEMP_FILE}"
21
	exit $1
22
}
23
 
24
function usage {
25
	# Display usage information
26
	echo "Usage: $(basename "$0")" 1>&2
27
}
28
 
29
# Call clean_up() on interrupt
30
trap clean_up SIGHUP SIGINT SIGTERM
31
 
32
if [ "$#" -lt "1" ]; then
33
	usage
34
	clean_up 1
35
fi
36