Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

When you use the standard rm command in Linux, it will delete the specified files, with no chance for recovering them back later. Write a

When you use the standard 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 file(s)

passed to it as command-line argument(s). For example, typing: srm file1 file2 file3

etc., the script shall not actually delete these files, but instead it shall move them to a

/home/user-name/trash 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

not exist, the script must create it.

2. The script shall then check the trash directory for files older than one week and delete them.

3. If the script is called with a r switch and a list of files (e.g. srm r file1 file2 file3

etc.), or a wildcard file pattern (e.g.: srm r file*) then it shall not delete the files, but

rather it shall recover the matching files in the trash, by moving them back to the same

directories they were deleted from.

4. If the script is called with a h switch (e.g. srm h file1 file2 file3 etc. or srm r

file*), then it shall do the same as the r switch, but all matching files shall be recovered to

the current directory.

i want to know how to execute the -r conmand

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

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions

Question

Discuss the ethical issues related to ICT

Answered: 1 week ago

Question

Restaurant Restaurant

Answered: 1 week ago