| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 
 | Description: fix bashisms in dump_disk example script
 Three conditionals in the examples/dump_on_cd_3/dump_disk are fixed to
 avoid bash-specific syntax.
Author: Chris Lamb <chris@chris-lamb.co.uk>
Reviewed-by: Bdale Garbee <bdale@gag.com>
Bug-Debian: http://bugs.debian.org/489570
--- a/examples/dump_on_cd_3/dump_disk
+++ b/examples/dump_on_cd_3/dump_disk
@@ -38,13 +38,8 @@ cleanup() {
 	rm -f $FIFO
 }
 
-error_exit() {
-	retcode=$?
-	echo >&2 "Error $retcode: exiting"
-	exit $retcode
-}
-
-trap error_exit ERR
+# exit on errors
+set -e
 
 write_output() {
 	# supplied info from "dump -F":
@@ -55,14 +50,14 @@ write_output() {
 	while [ "$ANSWER" != "y" ] ; do
 		echo -n "Is the disk ready? (y/n) "
 		read  </dev/tty ANSWER
-		if [ "$ANSWER" == "y" ] ; then
+		if [ "$ANSWER" = "y" ] ; then
 			(${RECORD_BIN}${1}) &
 			return 0
-		elif [ "$ANSWER" == "n" ] ; then
+		elif [ "$ANSWER" = "n" ] ; then
 			EXIT=""
 			echo -n "Do you really want to exit? (y/n) "
 			read </dev/tty EXIT
-			if [ "$EXIT" == "y" ] ; then
+			if [ "$EXIT" = "y" ] ; then
 				return 1
 			fi
 		fi
@@ -83,7 +78,7 @@ if [ "$#" = "2" ] && [ -p "$1" ]; then
 	exit 0
 else
 	mkfifo $FIFO
-	trap cleanup EXIT
+	trap cleanup 0
 	if write_output "$FIFO" "0"; then
 		if $DUMP "$@" -F "$0" -f "$FIFO" -B$BSIZE; then
 			echo "Waiting for background writing process to complete"
 |