xref: /freebsd/contrib/bsddialog/examples_utility/gauge.sh (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2021 by Alfonso Sabato Siciliano.
6#
7# To the extent possible under law, the author has dedicated all copyright
8# and related and neighboring rights to this software to the public domain
9# worldwide. This software is distributed without any warranty, see:
10#	<http://creativecommons.org/publicdomain/zero/1.0/>.
11
12characters="A B C D E F G"
13total=`echo $characters | awk '{print split($0, a)}'`
14i=1
15for c in $characters
16do
17	sleep 1
18	echo XXX
19	echo "$(expr $(expr $i "*" 100) "/" $total)"
20	echo "[$i/$total] Char: $c"
21	echo XXX
22	if [ $i -eq $total ]
23	then
24		sleep 1
25		echo EOF
26	fi
27	i=`expr $i + 1`
28done | ./bsddialog --title " gauge " --gauge "[0/$total] Starting..." 10 70
29