Question: Write a bash shell script scan.sh that takes two arguments 1. suffix - a string 2. N-a positive integer Your shell script will recursively scan

 Write a bash shell script "scan.sh" that takes two arguments 1.

Write a bash shell script "scan.sh" that takes two arguments 1. suffix - a string 2. N-a positive integer Your shell script will recursively scan the current directory for all files ending with the givern suffix, then sort the files by their size, and then print the the filenames of the largest N files to the standard output, followed by the sum of their sizes. Each file reported should be followed by the size of the file in bytes. If the total number of files found is less then N, report all files. The listed files should be sorted by the size, in descending order Sample output $ scan.sh jpg 5 ./face.jpg 88374 /a/b/school-jpg 88339 ./a/tree.jpg 38883 /b/housejpg 3001 /a/b/jpg 233 Total size: 218830 Hints You may consult the manual pages for one or more of the following utilities find, sort, head, awk You may use pipes "|" to feed the output of one utility program into another utility program as input . . * You can assume there will be no spaces in any of the filenames or directory names

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!