xref: /freebsd/contrib/dialog/samples/report-tempfile (revision ec0ea6efa1ad229d75c394c1a9b9cac33af2b1d3)
1#!/bin/sh
2# $Id: report-tempfile,v 1.9 2020/11/26 00:18:32 tom Exp $
3# Report results in a temporary-file.
4# vile:shmode
5
6case "${returncode:-0}" in
7  $DIALOG_OK)
8    echo "Result: `cat "$tempfile"`";;
9  $DIALOG_CANCEL)
10    echo "Cancel pressed.";;
11  $DIALOG_HELP)
12    echo "Help pressed: `cat "$tempfile"`";;
13  $DIALOG_EXTRA)
14    echo "Extra button pressed.";;
15  $DIALOG_ITEM_HELP)
16    echo "Item-help button pressed: `cat "$tempfile"`";;
17  $DIALOG_TIMEOUT)
18    echo "Timeout expired.";;
19  $DIALOG_ESC)
20    if test -s "$tempfile" ; then
21      cat "$tempfile"
22    else
23      echo "ESC pressed."
24    fi
25    ;;
26  *)
27    echo "Return code was $returncode";;
28esac
29