xref: /freebsd/contrib/bsddialog/examples_utility/gauge.sh (revision 7be9a3b45356747f9fcb6d69a722c1c95f8060bf)
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
11characters="A B C D E F G"
12total=`echo $characters | awk '{print split($0, a)}'`
13i=1
14for c in $characters
15do
16	sleep 1
17	echo XXX
18	echo "$(expr $(expr $i "*" 100) "/" $total)"
19	echo "[$i/$total] Char: $c"
20	echo XXX
21	if [ $i -eq $total ]
22	then
23		sleep 1
24		echo EOF
25	fi
26	i=`expr $i + 1`
27done | ./bsddialog --title " gauge " --gauge "[0/$total] Starting..." 10 70
28
29