-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzfAlias.sh
46 lines (43 loc) · 1.08 KB
/
zfAlias.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
#!/bin/bash
# Array de opções
options=("Create aliases")
# Função para desenhar o menu
function show_menu() {
clear
echo -e "\e[100m afAlias CLI \e[1;93mv1.0.0 \e[39;49m"
echo ""
for i in "${!options[@]}"; do
if [[ $i == $selected ]]; then
echo -e "\e[36;1m > \e[35m${options[$i]}\e[0m"
else
echo " ${options[$i]}"
fi
done
}
# Controle de seleção
selected=0
while true; do
show_menu
read -s -n 1 key
case $key in
$'\x1b')
read -s -n 2 key
if [[ $key == "[A" ]]; then
((selected--))
if [ $selected -lt 0 ]; then
selected=$((${#options[@]} - 1))
fi
elif [[ $key == "[B" ]]; then
((selected++))
if [ $selected -ge ${#options[@]} ]; then
selected=0
fi
fi
;;
"")
if [ "${options[$selected]}" == "Create aliases" ]; then
./a.out
break
fi;;
esac
done