-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbattery.sh
41 lines (39 loc) · 942 Bytes
/
battery.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
#!/usr/bin/env sh
function print_battery () {
case $1 in
0)
fill_str=" "
;;
1)
fill_str=" \033[42m \033[m "
;;
2)
fill_str=" \033[42m \033[m \033[42m \033[m "
;;
3)
fill_str=" \033[42m \033[m \033[42m \033[m \033[42m \033[m "
;;
*)
fill_str=" \033[42m \033[m \033[42m \033[m \033[42m \033[m \033[42m \033[m"
esac
printf ".-------------.\n"
printf "|${fill_str} |.\n"
printf "|${fill_str} |\n"
printf "|${fill_str} |'\n"
printf "'-------------'\n"
}
clear
power=''
print_battery 0
sleep 0.5
while [ 1 ]; do
for i in $(seq 0 4); do
printf "\033[1;1H"
print_battery ${i}
sleep 0.1
done
power="d${power}"
if [ "x${power}" = "xdddddddddddddddddddddddddddddd" ]; then
exit
fi
done