The language is Linux/Unix gedit Write a script that will do the following: Prov
ID: 3729399 • Letter: T
Question
The language is Linux/Unix gedit
Write a script that will do the following:
Provide a comment section at the top of the script, with your name, the date, and the purpose of the program.
Use the select loop to produce a menu of foods.
Produce output to resemble the following:
1) Steak and potatoes
2) Fish and chips
3) Soup and salad
Please make a selection. 1
Stick to your ribs
Watch your cholesterol.
Enjoy your meal.
1) Steak and potatoes
2) Fish and chips
3) Soup and salad
Please make a selection. 2
British are coming!
Enjoy your meal.
1) Steak and potatoes
2) Fish and chips
3)Soup and salad
Please make a selection. 3
Health foods…
Dieting is so boring.
Enjoy your meal.
Explanation / Answer
#!/bin/ksh
# Set PS3 prompt
PS3="Please make a selection. "
select DRINK in "Steak and potatoes" "Fish and chips" "Soup and salad"
do
case $DRINK in
"Steak and potatoes")
echo "Stick to your ribs"
echo "Watch your cholesterol."
echo "Enjoy your meal."
;;
"Fish and chips")
echo "British are coming"
echo "Enjoy your meal."
;;
"Soup and salad")
echo "Health foods…"
echo "Dieting is so boring."
echo "Enjoy your meal."
;;
*) echo "ERROR: Invalid selection"
;;
esac
done
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.