Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

T Sql Window Functions For Data Analysis And Beyond

Authors: Itzik Ben Gan

2nd Edition

0135861446, 978-0135861448

More Books

Students also viewed these Databases questions

Question

please dont use chat gpt 4 3 4 . .

Answered: 1 week ago