newUpdates
This commit is contained in:
13
Bash_scripting/colors.sh
Executable file
13
Bash_scripting/colors.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --- Color/Style Variables ---
|
||||
RED='\e[0;31m'
|
||||
GREEN='\e[0;32m'
|
||||
YELLOW='\e[1;33m' # 1 for Bold, 33 for Yellow
|
||||
NC='\e[0m' # No Color - Reset all attributes
|
||||
|
||||
# --- Usage Example ---
|
||||
echo -e "${GREEN}SUCCESS:${NC} Configuration loaded successfully."
|
||||
echo -e "${RED}ERROR:${NC} Failed to connect to database."
|
||||
echo -e "${YELLOW}WARNING:${NC} Disk space is getting low."
|
||||
echo -e "This is ${RED}Red ${NC}and this is ${YELLOW}Yellow${NC} text."
|
||||
@@ -1,6 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
RED='\e[1;31m'
|
||||
GREEN='\e[1;32m'
|
||||
YELLOW='\e[1;33m'
|
||||
BLUE='\e[1;34m'
|
||||
NC='\e[0m'
|
||||
|
||||
user=$(whoami)
|
||||
echo "Welcome, $user. Please enjoy this short presentation! "
|
||||
echo -e "Welcome, ${BLUE}$user${NC}. Please enjoy this short presentation! "
|
||||
|
||||
read -p "Please enter a number:" num
|
||||
if ((num % 2 == 0))
|
||||
@@ -21,17 +28,17 @@ secret=1
|
||||
if ((num2 == secret))
|
||||
then
|
||||
i=3
|
||||
echo "You have found the secret recipe of Coca Cola!! ^_^"
|
||||
echo -e "${GREEN}You have found the secret recipe of Coca Cola!! ^_^${NC}"
|
||||
|
||||
else
|
||||
echo "You were so close to finding the secret recipe :("
|
||||
echo -e "${YELLOW}You were so close to finding the secret recipe :(${NC}"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
done
|
||||
|
||||
echo "Let's try something else. Please answer with a *yes* or *no*."
|
||||
echo -e "${BLUE}Let's try something else. Please answer with a *yes* or *no*.${NC}"
|
||||
yes=0
|
||||
no=1
|
||||
|
||||
@@ -43,26 +50,26 @@ then
|
||||
read -p "Are there any fish with legs?: " Answer
|
||||
if ((Answer == 0))
|
||||
then
|
||||
echo "Your answer is correct! Mudskippers are the champions of land-walking fish, but we also have the Lungfish, Walking Catfish, Sea Robins, Frogfish or Handifsh. Visit: https://factanimal.com/wp-content/uploads/2023/07/mudskipper-breathing.jpg"
|
||||
echo -e "${GREEN}Your answer is correct! Mudskippers are the champions of land-walking fish, but we also have the Lungfish, Walking Catfish, Sea Robins, Frogfish or Handifsh.${NC} Visit: https://factanimal.com/wp-content/uploads/2023/07/mudskipper-breathing.jpg"
|
||||
else
|
||||
echo "Your answer is not correct, but don't worry, you are not the only one :D. Visit: https://encrypted-tbn0.gstatic.com/licensed-image?q=tbn:ANd9GcR9laMdCqTkfxW005yPkIED-dHsWvq3IcjPToZi130LpKQVlS5JT9W6u-w2ZMCa7JdDPYXUoqwQKakceVaUotuOA6_RCZF1wSfl2Mvoau2PUKen-0U"
|
||||
echo -e "${RED}Your answer is not correct, but don't worry, you are not the only one :D.${NC} Visit: https://encrypted-tbn0.gstatic.com/licensed-image?q=tbn:ANd9GcR9laMdCqTkfxW005yPkIED-dHsWvq3IcjPToZi130LpKQVlS5JT9W6u-w2ZMCa7JdDPYXUoqwQKakceVaUotuOA6_RCZF1wSfl2Mvoau2PUKen-0U"
|
||||
fi
|
||||
elif ((j == 1))
|
||||
then
|
||||
read -p "Are there any animals with no toes?: " Answer
|
||||
if ((Answer != 0))
|
||||
then
|
||||
echo "Your answer is correct! Horses are commonly known for having just a toe under their hooves, but one toe is still more than none! Visit: https://i.chzbgr.com/full/10509587456/h1B5A4D29/this-actually-is-my-first-rodeo"
|
||||
echo -e "${GREEN}Your answer is correct! Horses are commonly known for having just a toe under their hooves, but one toe is still more than none!${NC} Visit: https://i.chzbgr.com/full/10509587456/h1B5A4D29/this-actually-is-my-first-rodeo"
|
||||
else
|
||||
echo "Your answer is not correct. There is no animal without any toes. Hooves are modified toenails covering the tips of toes. Visit: https://cdn.britannica.com/28/85428-050-40FEA973/Hoof-horse.jpg"
|
||||
echo -e "${RED}Your answer is not correct. There is no animal without any toes. Hooves are modified toenails covering the tips of toes.${NC} Visit: https://cdn.britannica.com/28/85428-050-40FEA973/Hoof-horse.jpg"
|
||||
fi
|
||||
else
|
||||
read -p "Is the blue whale the heaviest animal on this planet?: " Answer
|
||||
if ((Answer == 0))
|
||||
then
|
||||
echo "Your answer is correct! The second heaviest animal ever to have existed on Earth is the fin whale (Balaenoptera physalus), with some historical estimates reaching up to 130 tons. Visit: https://www.reddit.com/media?url=https%3A%2F%2Fexternal-preview.redd.it%2FU7IzglHNEVnaT_F58bDjHwB8WqMZDyRNeujcpLqP25s.jpg%3Fwidth%3D1080%26crop%3Dsmart%26auto%3Dwebp%26s%3Df77ae8f9652158dd102218fbb58e1bf665b5a1ab"
|
||||
echo -e "${GREEN}Your answer is correct! The second heaviest animal ever to have existed on Earth is the fin whale (Balaenoptera physalus), with some historical estimates reaching up to 130 tons.${NC} Visit: https://www.reddit.com/media?url=https%3A%2F%2Fexternal-preview.redd.it%2FU7IzglHNEVnaT_F58bDjHwB8WqMZDyRNeujcpLqP25s.jpg%3Fwidth%3D1080%26crop%3Dsmart%26auto%3Dwebp%26s%3Df77ae8f9652158dd102218fbb58e1bf665b5a1ab"
|
||||
else
|
||||
echo "Your answer is not correct. Blue whales are widely regarded as the heaviest animals to have ever existed on Earth, with recorded weights up to 190 - 200 tons. Visit: https://familylifetips.com/wp-content/uploads/2021/07/Whale-Meme-Whale-Hello-There-Family-Life-Tips-Magazine.jpg"
|
||||
echo -e "${RED}Your answer is not correct. Blue whales are widely regarded as the heaviest animals to have ever existed on Earth, with recorded weights up to 190 - 200 tons.${NC} Visit: https://familylifetips.com/wp-content/uploads/2021/07/Whale-Meme-Whale-Hello-There-Family-Life-Tips-Magazine.jpg"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user