Question: Exercise 2. The default rm command will not confirm before it deletes any regular files. Write a short script called safe_rm, such that it will

Exercise 2. The default rm command will not confirm before it deletes any regular files. Write a short script called safe_rm, such that it will make a copy before deleting a single file (that is, we do not use wildcard expressions for this problem) by doing the following: Take one and only one argument at the command line (hint: search for an expression rep- resenting the number of arguments in the shell scripts). Print out an error message if no argument or more than one arguments are provided (hint: use echo). Create a directory safe_rm_recycle" in the current one if it is not already created. Copy the file indicated by the first argument to this safe_rm_recycle" folder. Remove this file in the current working directory.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!