#! /bin/sh
# $Id: checklist9,v 1.1 2004/03/13 19:25:43 tom Exp $
# "checklist8" using --file
: ${DIALOG=dialog}

tempfile="`mktemp -t dialog-samples.XXXXXX`" || exit 
trap 'rm -f -- "$tempfile"' EXIT
trap 'trap - EXIT; rm -f -- "$tmpfile"; exit 1' HUP INT QUIT TERM

$DIALOG --file checklist9.txt 2>$tempfile

retval=$?

choice=`cat $tempfile`
case $retval in
  0|2)
    echo "'$choice' chosen.";;
  1)
    echo "Cancel pressed.";;
  255)
    echo "ESC pressed.";;
  *)
    echo "Unexpected code $retval";;
esac
