-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect.sh
More file actions
executable file
·45 lines (40 loc) · 829 Bytes
/
select.sh
File metadata and controls
executable file
·45 lines (40 loc) · 829 Bytes
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
#!/bin/bash
RESTORE=$'\033[0m'
RED=$'\033[00;31m'
GREEN=$'\033[00;32m'
YELLOW=$'\033[00;33m'
BLUE=$'\033[00;34m'
PURPLE=$'\033[00;35m'
CYAN=$'\033[00;36m'
LIGHTGRAY=$'\033[00;37m'
LRED=$'\033[01;31m'
LGREEN=$'\033[01;32m'
LYELLOW=$'\033[01;33m'
LBLUE=$'\033[01;34m'
LPURPLE=$'\033[01;35m'
LCYAN=$'\033[01;36m'
WHITE=$'\033[01;37m'
echo "${GREEN}==============="
echo "#### SELECT #####"
echo "===============${RESTORE}"
echo
echo "${YELLOW}Usage:${RESTORE}"
cat <<EOF
select ITEM in [LIST]
do
command1
command2
command3
done
EOF
echo "${BLUE}Example:${RESTORE}"
out='PS3="Enter a number: "
select character in Sheldon Leonard Penny Howard Raj
do
echo "Selected character: $character"
echo "Selected number: $REPLY"
echo "Use CNTRL+C to exit"
done'
echo "${out}"
echo "${GREEN}TEST:${RESTORE}"
eval "${out}"