Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a bash shell script to carry out the following task: When you use the rm command in Linux, it will delete the specified files,

Write a bash shell script to carry out the following task:

image text in transcribed

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 the command: srm file1 file2 file3, the script shall not actually delete these files, but instead it shall move them to a /home/your-name/trash directory. Also, the script shall do the following:

1. When it starts, it shall check the trash directory for files older than 48 hours and delete them. 2. If the script is called with a r switch (i.e. srm r file1 file2 file3), then it shall not delete anything, 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. 3. If the script is called with a h switch (i.e. srm h file1 file2 file3), then it shall do the same as the r switch, but found files shall be recovered to the current directory.

Write a bash shell script to carry out each of the following tasks: a. Safe Delete: 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 the command "srm filel file2 file3", the script shall not actually delete these files, but instead it shall move them to a /homeyour- name trash directory. Also, the script shall do the following: l. When it starts, it shall check the trash directory for files older than 48 hours and delete them. 2. If the script is called with a -r switch (i.e. srm -r filel file2 file3), then it shall not delete anything, 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. 3. If the script is called with a -h switch (i.e. srm -h filel file2 file3), then it shall do the same as the -r switch, but found files shall be recovered to the current directory

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

Students also viewed these Databases questions

Question

3 How supply and demand together determine market equilibrium.

Answered: 1 week ago

Question

1 What demand is and what affects it.

Answered: 1 week ago