-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprogressExample.sh
executable file
·53 lines (45 loc) · 1.28 KB
/
progressExample.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/zsh
#set -x
# An array containing the list of items to progress through
itemsToProgress=(
"Bribing a tank..."
"Begging for a healer..."
"Conjuring water..."
"Summoning party..."
"Wiping on trash..."
"Rage quitting..."
"Uninstall Complete!"
)
# Path to our dialog binary
dialogPath='/usr/local/bin/dialog'
# Path to our dialog command file
dialogCommandFile=$(mktemp /var/tmp/exampleDialog.XXXXX)
# This function sends a command to our command file, and sleeps briefly to avoid race conditions
function dialog_command()
{
echo "$@" >> "$dialogCommandFile"
sleep 0.1
}
# Calling our initial dialog window. The & is crucial so that our script progresses.
# ${#itemsToProgress[@]} is equal to the number of items in our array
$dialogPath \
--title "Looking for Group" \
--message " " \
--mini \
--commandfile "$dialogCommandFile" \
--progress ${#itemsToProgress[@]} \
--icon "SF=bolt.circle color1=pink color2=blue" \
&
# Display the bouncy bounce for 2 seconds
sleep 2
# Iterate through our array
# For each item we've outlined
for i in "${itemsToProgress[@]}"; do
dialog_command "progress: increment"
dialog_command "progresstext: $i"
sleep 3
done
# Close our dialog window
dialog_command "quit:"
# Delete our command file
rm "$dialogCommandFile"