-
Notifications
You must be signed in to change notification settings - Fork 42
/
test_bar.sh
executable file
·37 lines (32 loc) · 982 Bytes
/
test_bar.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
#!/bin/bash
# Source progress bar
source ./progress_bar.sh
generate_some_output_and_sleep() {
echo "Here is some output"
head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-'
head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-'
head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-'
head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-'
echo -e "\n\n------------------------------------------------------------------"
echo -e "\n\n Now sleeping briefly \n\n"
sleep 0.3
}
main() {
# Make sure that the progress bar is cleaned up when user presses ctrl+c
enable_trapping
# Create progress bar
setup_scroll_area
for i in {1..99}
do
if [ $i = 50 ]; then
echo "waiting for user input"
block_progress_bar $i
read -p "User input: "
else
generate_some_output_and_sleep
draw_progress_bar $i
fi
done
destroy_scroll_area
}
main