Question: uestion 1 [ 6 Points ] A data file named fruits.txt contains the following entries in the format < uantity > : Mango A 1

uestion 1[6 Points]
A data file named fruits.txt contains the following entries in the format
<uantity>: Mango A 1003
Orange C 504
Banana B 402
Apple E 906
Kiwi C 2005
Guava C 258
Papaya A 7510
Avocado K 3002
Write a shell program named info.sh that takes in 0 or 1 arguments from the user and based on them performs the following tasks:
For 0 arguments, display the fruit name and total price (Price X uantity) in each line
For 1 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 2 or more arguments print an error message Example:
Input: info.sh C Output: Orange
Kiwi Guava 1400

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!