-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdance
executable file
·73 lines (65 loc) · 1018 Bytes
/
dance
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
howlong="$1"
printhead() {
if [ "$1" == "0" ]; then
echo "\o/"
elif [ "$1" == "1" ]; then
echo "\o|"
elif [ "$1" == "2" ]; then
echo "|o|"
elif [ "$1" == "3" ]; then
echo "|o/"
else
echo "|o|"
fi
}
printbody() {
echo " | "
}
printlegs() {
if [ "$1" == "0" ]; then
echo "/ \ "
elif [ "$1" == "1" ]; then
echo "| \ "
elif [ "$1" == "2" ]; then
echo "| | "
elif [ "$1" == "3" ]; then
echo "/ | "
else
echo "| | "
fi
}
printman() {
printhead "0"
printbody
printlegs "0"
}
danceman() {
for iterator in 1 2 3 0
do
sleep 0.2
printf "\033[3A"
printf "\033[K"
printhead "$iterator"
printf "\033[K"
printbody
printf "\033[K"
printlegs "$iterator"
done
}
main() {
printman "0"
if [ "$1" == "" ]; then
danceman
elif [ "$1" == "forever" ]; then
while true; do
danceman
done
else
for (( c=1; c<="$1"; c++ ))
do
danceman
done
fi
}
main "$howlong"