Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this shell script you will take some input from the user and use that input to find files and send the matching output to

In this shell script you will take some input from the user and use that input to find files and send the matching output to files. This is a task that would be common in managing users. We will find files that are the most and least recently edited. In this script you will use only the if control structure, no loops will be used. It is recommended to write out on paper the logical steps necessary to achieve the tasks of this script. It is much easier and quicker to do this on paper and then translate it into bash script later. Most of you will ignore this advice and spend more time and frustration than necessary, you have been advised ;) Write a shell script (~/Documents/cis90/lab12.sh) that: Finds the most recent (and least recent in separate steps) "x" number of edited files in directory "y" where x and y are positional parameters passed from the user to the script during execution of the script. Take in from the user (prompt and read response) the target file names, 3 files here one file for the complete results of all files in the directory, name the variable $complete_results one file for the top x results (most recent), name the variable $top_results one file for the bottom x results (least recent), name the variable $bottom_results Take in from the user (prompt and read response) the directory where the output files will be located. Name this variable $output_dir Creates variables $x and $y to assign the shell parameters to Uses the $x and $y variables instead of the shell parameters thereafter in the program Has comments explaining: the purpose of the script the variables used and if those variables are required or optional The script must test for valid input on each of the fields. If the input isn't valid report the error back to the user and exit the script. Output the complete results to a file, $complete_results. Output only the top "x" results and write that to another file, $top_results. Output only the bottom "x" results and write that to another file, $bottom_results.

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago