Question: Take the following code and rewrite it using a switch statement (Your code should not have an if-then-else statement when finished): #!/bin/bash read -p Enter

Take the following code and rewrite it using a switch statement (Your code should not have an if-then-else statement when finished):

#!/bin/bash

read -p "Enter your age: " AGE

if [ $AGE -lt 20 ]; then

echo "You are just a teenager!"

elif [ $AGE -lt 30 ]; then

echo "You are a young adult!"

elif [ $AGE -lt 40 ]; then

echo "You are a moderate age adult!" else echo "You are really old!"

fi

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!