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

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!