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