Question: (Linux) Write a shell script to solve the following problem: Write a shell script that will create a backup of the file specified as an

(Linux)

Write a shell script to solve the following problem:

Write a shell script that will create a backup of the file specified as an argument. This backup file will be saved in ~/backups/ with ?date appended to the original file name. date shall be in the form yymmdd:HHmm. Your script should check to make sure the ~/backups/ directory exists before copying files, creating the directory if necessary. Ensure your script will properly accept a file argument with path information and strip any path information prior to copying the file.

For example, the file ~/test/lab37q1.sh would be backed up to ~/backups/lab37q1.sh?100407:1340

The basename command may be helpful here.

The date command can be used to display the date and time in various formats.

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!