Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Shell scripts!! Test your scripts thoroughly before you submit the assignment, to make sure it will do the tasks as described and make sure

Write Shell scripts!!

image text in transcribed

Test your scripts thoroughly before you submit the assignment, to make sure it will do the tasks as described and make sure that all possible errors are handled correctly.

Safe Delete (srm): When you use the "rm" command in Linux, it will delete the specified files, with no chance for recovering them back later. Write a script (called srm) that will safely delete the files passed to it as command-line arguments. For example, typing: "srm filel file2 file3 .etc.", the script shall not actually delete these files, but instead it shall move them to a Ihome/user-nameltrash directory. Also, the script shall do the following 1. When it starts, it shall check for the existence of directory /home/user-name/trash, if it does a. not exist, the script must create it 2. The script shall then check the trash directory for files older than 72 hours and delete them 3. If the script is called with a -r switch (i.c. srm -r filel file2 file3. ..et), then it shall not delete them, but rather it shall recover these files by searching for them in the trash, and if it finds any one of them it shall move it back to the same directory it was deleted from If the script is called with a -h switch (i.e. srm -h filel file2 file3 ...etc.), then it shall do the same as the -r switch, but found files shall be recovered to the current directory 4. b. Word-Character Count (lwcc) Write a script (called lwcc) to count and report the number of characters and words in each line of a given file(s). The input to the script is a file list (one or more files separated by a space). The reported output shall include, for each file, the file name followed by a colon (:) on one line, and starting from the next line it shall print one triplet "### wc## cc###, per line of the input file, such that five triplets, separated by " | ", are printed per output line. For example, suppose the input file is called abcd which contains the 5 lines above, then the output of the command "1wcc abcd" would print the following abcd: 001 wc19 cc099 |002 wc21 cc101 003 wc19 cc100 |004 wc19 cce99 005 wc14 cc073

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago