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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started