xref: /freebsd/contrib/bsddialog/examples_utility/mixedgauge.sh (revision 963f5dc7a30624e95d72fb7f87b8892651164e46)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2021 by Alfonso Sabato Siciliano.
6# To the extent possible under law, the author has dedicated all copyright
7# and related and neighboring rights to this software to the public domain
8# worldwide. This software is distributed without any warranty, see:
9# <http://creativecommons.org/publicdomain/zero/1.0/>.
10
11
12input="A B C D E F G H"
13total=`echo $input | awk '{print split($0, a)}'`
14curr=1
15for i in $input
16do
17        perc="$(expr $(expr $curr "*" 100 ) "/" $total )"
18        curr=`expr $curr + 1`
19	./bsddialog --sleep 1 --title " mixedgauge " --mixedgauge "Example" 25 50  $perc \
20		"Hidden!"     8	\
21		"Label   1"   0	\
22		"Label   2"   1	\
23		"Label   3"   2	\
24		"Label   4"   3 \
25		"Label   5"   4	\
26		"Label   6"   5	\
27		"Label   7"   6	\
28		"Label   8"   7	\
29		"Label   9"   9	\
30		"Label  10"  10	\
31		"Label   X"  " -$perc"
32	#sleep 1
33done
34
35