-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSHELL-SCRIPT-PROGRESS-BAR.txt
More file actions
46 lines (28 loc) · 1.28 KB
/
SHELL-SCRIPT-PROGRESS-BAR.txt
File metadata and controls
46 lines (28 loc) · 1.28 KB
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
https://www.youtube.com/watch?v=xIfsdW6ripo
https://www.youtube.com/watch?v=93i8txD0H3Q --> IMP
http://fitnr.com/showing-a-bash-spinner.html --> IMP
http://www.thegeeky.space/2013/10/how-to-do-progress-indicator-using-bash_1684.html --> VVIMP
https://stackoverflow.com/questions/12498304/using-bash-to-display-a-progress-indicator
while true; do for X in '-' '/' '|' '\'; do echo -en "\b$X"; sleep 0.1; done; done
#!/bin/bash
LIST="1 2 3 4 5 6 7 8 9 10" #Note that there is a different when we
INT=1 #use (),"",'' .Maybe Ill explain in diff. post
CNT=0
for NIM in ${LIST} #For function as controlling loop
do
len=$(echo ${LIST} | wc -w) #"wc"command is used print new line
echo -en "\b\b\b$(($NIM*100/$len))%"
sleep $INT
done
=================================================================================================================
#!/bin/bash
CHA=( "-" "\\" "|" "/" )
INT=1
CNT=0
while true #While function as controlling loop
do
loc=$(($CNT % 4)) #using the modulo expression for arithmetic fn
echo -en "\b${CHA[$loc]}" #check this link for bash arrays info.
CNT=$(($CNT + 1)) #Increasing the CouNTer
sleep $INT
done