Answered step by step
Verified Expert Solution
Question
1 Approved Answer
uestion 1 [ 6 Points ] A data file named fruits.txt contains the following entries in the format < uantity > : Mango A 1
uestion Points
A data file named fruits.txt contains the following entries in the format
uantity: Mango A
Orange C
Banana B
Apple E
Kiwi C
Guava C
Papaya A
Avocado K
Write a shell program named info.sh that takes in or arguments from the user and based on them performs the following tasks:
For arguments, display the fruit name and total price Price X uantity in each line
For argument,
o If the argument is a single character, print all the fruits from fruits.txt that contain that vitamin followed by their total price in new line Find total price of each fruit then sum up for all the included fruits
o If argument is a number, print all fruits whose Unit Price not total price is less than or equal to it
o Else argument is a string print the Vitamin and Unit Price of the fruit whose name matches with the argument even if case doesn't match
For or more arguments print an error message Example:
Input: info.sh C Output: Orange
Kiwi Guava
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started