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
Get step-by-step solutions from verified subject matter experts
