Question
Write a script that will backup a single file to the specified location with the specified name. You can name the script backup.sh. 1. The
Write a script that will backup a single file to the specified location with the specified name. You can name the script backup.sh.
1. The script takes three parameters: the file to be backed up, the directory to save the backup, and the name of the backup. For example, I have a file called foo.txt that I want to backup to the bin folder under my home directory. I want to name the backup fooBackup: ./backup.sh foo.txt ~/bin fooBackup
2. The script will print out an informative error message if the user does not supply exactly three parameters.
3. The script needs to check that the supplied file exists and is a regular file and that the supplied directory is a directory
4. In the event that one of the above conditions fail, print out an informative error message stating the specific issue. The expectation is for only one error to print (whichever error is caught first).
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