mirror of
https://github.com/Mayccoll/Gogh.git
synced 2023-08-10 21:12:46 +03:00
gogh: some more improvements
* Add a condition for the theme OPTION to be greater than zero as well - This prevents the Usage of Negative Index, which prints the n-th element from behind Reference: https://unix.stackexchange.com/questions/198787/is-there-a-way-of-reading-the-last-element-of-an-array-with-bash * Specify the user a way to EXIT by pressing the ENTER key without any options * Reduce some lines in the code -> Using '\n' Signed-off-by: a7r3 <arvindultimate7352@gmail.com>
This commit is contained in:
parent
b39441a1b0
commit
7787798865
13
gogh.sh
13
gogh.sh
@ -179,17 +179,14 @@ NUM=1
|
|||||||
# | ::::::: Print Colors
|
# | ::::::: Print Colors
|
||||||
# |
|
# |
|
||||||
echo -e "
|
echo -e "
|
||||||
Gogh
|
Gogh\n
|
||||||
\e[0;30m█████\\e[0m\e[0;31m█████\\e[0m\e[0;32m█████\\e[0m\e[0;33m█████\\e[0m\e[0;34m█████\\e[0m\e[0;35m█████\\e[0m\e[0;36m█████\\e[0m\e[0;37m█████\\e[0m
|
\e[0;30m█████\\e[0m\e[0;31m█████\\e[0m\e[0;32m█████\\e[0m\e[0;33m█████\\e[0m\e[0;34m█████\\e[0m\e[0;35m█████\\e[0m\e[0;36m█████\\e[0m\e[0;37m█████\\e[0m
|
||||||
\e[0m\e[1;30m█████\\e[0m\e[1;31m█████\\e[0m\e[1;32m█████\\e[0m\e[1;33m█████\\e[0m\e[1;34m█████\\e[0m\e[1;35m█████\\e[0m\e[1;36m█████\\e[0m\e[1;37m█████\\e[0m"
|
\e[0m\e[1;30m█████\\e[0m\e[1;31m█████\\e[0m\e[1;32m█████\\e[0m\e[1;33m█████\\e[0m\e[1;34m█████\\e[0m\e[1;35m█████\\e[0m\e[1;36m█████\\e[0m\e[1;37m█████\\e[0m"
|
||||||
|
|
||||||
# |
|
# |
|
||||||
# | ::::::: Print Themes
|
# | ::::::: Print Themes
|
||||||
# |
|
# |
|
||||||
echo -e "
|
echo -e "\nThemes:\n"
|
||||||
Themes:
|
|
||||||
(\\e[0m\e[0;34m 00 \\e[0m\e[0m) EXIT
|
|
||||||
"
|
|
||||||
|
|
||||||
for TH in "${THEMES[@]}"; do
|
for TH in "${THEMES[@]}"; do
|
||||||
|
|
||||||
@ -206,8 +203,8 @@ done
|
|||||||
# |
|
# |
|
||||||
# | ::::::: Select Option
|
# | ::::::: Select Option
|
||||||
# |
|
# |
|
||||||
echo -e "Usage : Enter Desired Themes Numbers (\\e[0m\e[0;34mOPTIONS\\e[0m\e[0m) Separated By A Blank Space"
|
echo -e "\nUsage : Enter Desired Themes Numbers (\\e[0m\e[0;34mOPTIONS\\e[0m\e[0m) Separated By A Blank Space"
|
||||||
|
echo -e " Press \e[0;34mENTER\\e[0m without options to Exit\n"
|
||||||
read -p 'Enter OPTION(S) : ' -a OPTION
|
read -p 'Enter OPTION(S) : ' -a OPTION
|
||||||
|
|
||||||
|
|
||||||
@ -216,7 +213,7 @@ read -p 'Enter OPTION(S) : ' -a OPTION
|
|||||||
# |
|
# |
|
||||||
for OP in "${OPTION[@]}"; do
|
for OP in "${OPTION[@]}"; do
|
||||||
|
|
||||||
if [[ OP -le ARRAYLENGTH ]]; then
|
if [[ OP -le ARRAYLENGTH && OP -gt 0 ]]; then
|
||||||
FILENAME="${THEMES[((OP-1))]::-3}"
|
FILENAME="${THEMES[((OP-1))]::-3}"
|
||||||
FILENAME_SPACE="${FILENAME//-/ }"
|
FILENAME_SPACE="${FILENAME//-/ }"
|
||||||
echo "Theme: ${FILENAME_SPACE^}"
|
echo "Theme: ${FILENAME_SPACE^}"
|
||||||
|
Loading…
Reference in New Issue
Block a user