xref: /freebsd/contrib/dialog/samples/report-tempfile (revision f7c32ed617858bcd22f8d1b03199099d50125721)
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