-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_py.sh
executable file
·70 lines (68 loc) · 1.29 KB
/
build_py.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# Colors
GREEN="\033[1;32m"
NC="\033[0m"
YELLOW="\033[1;33m"
MAGENTA="\033[1;35m"
RED="\033[0;31m"
# Main Script
clear
echo -e "${GREEN}" "Available Files -${NC}"
for f in *.py; do echo "${f}"; done
echo ""
echo -e "${RED}Type 'quit' to exit${NC}"
echo ""
echo -e "Enter File Name -- ${YELLOW}Without '.py' Extension${NC}"
read -r fname
if [[ ${fname} == "quit" ]]; then
clear
echo "Choosing to quit? Off you go!"
echo ""
echo -e "${MAGENTA}K Thanks, Bye!${NC}"
sleep 2
exit
fi
if [[ -f ${fname}.py ]]; then
clear
echo "Running '${fname}.py' with Python3"
sleep 2
clear
python3 "${fname}.py"
else
clear
echo -e "'${fname}' ${RED}does not exist!${NC}"
echo "Check the file name, and try again"
echo ""
echo "Exiting!!"
echo ""
echo -e "${MAGENTA}K Thanks, Bye!${NC}"
sleep 2
clear
exit
fi
echo ""
echo -e "${YELLOW}Show Source Code?${NC}"
echo ""
echo "'y' for yes and anything else for no"
read -r temp
if [[ ${temp} = "y" ]]; then
clear
echo -e "${YELLOW}///// Source Code for '${fname}.py' /////${NC}"
echo ""
cat "${fname}.py"
sleep 5
echo ""
echo -e "Press 'y' to ${RED}Exit${NC}"
read -r temp
if [[ ${temp} = "y" ]]; then
clear
echo -e "${MAGENTA}K Thanks, Bye!${NC}"
sleep 2
exit
fi
else
clear
echo -e "${MAGENTA}K Thanks, Bye!${NC}"
sleep 2
exit
fi