MyProject
This commit is contained in:
65
Bash_scripting/myproject.sh
Executable file
65
Bash_scripting/myproject.sh
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
user=$(whoami)
|
||||||
|
echo "Welcomem, $user. Please enjoy this short presentation! "
|
||||||
|
|
||||||
|
read -p "Please enter a number:" num
|
||||||
|
if (( num%2==0 ))
|
||||||
|
then
|
||||||
|
echo "$num is even"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$num is odd"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
for (( i=0; i<3; i++ ))
|
||||||
|
do
|
||||||
|
read -p "You have three attempts to find the secret recipe, so please enter another number between 1 and 10: " num2
|
||||||
|
secret=1
|
||||||
|
|
||||||
|
if (( num2==secret ))
|
||||||
|
then
|
||||||
|
i=3
|
||||||
|
echo "You have found the secret recipe of Coca Cola!! ^_^"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "You were so close to finding the secret recipe :("
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Let's try something else. Please type 1 or 0 (1 for false, 0 for true)"
|
||||||
|
|
||||||
|
for (( j=0; j<=2; ++j ))
|
||||||
|
do
|
||||||
|
|
||||||
|
if (( j==0 ))
|
||||||
|
then
|
||||||
|
read -p "Are there any fish with legs? 1 or 0: " 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"
|
||||||
|
else
|
||||||
|
echo "Your answer is not correct, but don't worry, you are not the only one :D"
|
||||||
|
fi
|
||||||
|
elif (( j==1 ))
|
||||||
|
then
|
||||||
|
read -p "Are there any animals with no toes? 1 or 0: " 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!"
|
||||||
|
else
|
||||||
|
echo "Your answer is not correct. There is no animal without any toes. Hooves are modified toenails covering the tips of toes."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
read -p "Is the blue whale the heaviest animal on this planet? 1 or 0: " 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"
|
||||||
|
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"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user