Question
Write a bash script that accepts two command-line parameters: (1) a directory name, either absolute or relative, and (2) a size in bytes. For a
Write a bash script that accepts two command-line parameters: (1) a directory name, either absolute or relative, and (2) a size in bytes. For a valid directory, you will print out the list of files along with the size (in bytes) of each file only for those files whose size is greater than or equal to the size specified by the user in the command-line.
Your script must adhere to the following requirements:
If the user enters too few or too many arguments, you are to display an appropriate usage statement and terminate the program.
Since the directory given in the command-line may be absolute or relative, you must check that it is a valid directory. If the directory is not valid, you will print out an error message and terminate the program.
You must implement and use at least one non-trivial function in your bash script that accepts at least one parameter.
You must use at least one non-trivial sed or gawk command within your script. For use with these commands, you may wish to redirect some output from your script to a file called minor3.tmp and apply your sed and/or gawk command.
If no files match your criteria for the size of the file, you will print out some indicator that no files matched your criteria.
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