Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This course is included unix, so please show me how you finish it step by step including the run about case1 and case2 in the

This course is included unix, so please show me how you finish it step by step including the run about case1 and case2 in the unix system.

image text in transcribed

Write a Bash script to back up a list of files with some given extensions. Basically the files are copied into a folder created in the target directory, named the current date. The name is a string obtained from date command, but blanks and : are removed, using tr command. E.g., Tue Jan2211 2241 EDT2021 is a valid name, obtained using date and tr. Then, all files are archived using tar utility then, the original files (the ones just copied) are removed. The name of the archive should be archive.tar Synopsis: backup [-t] target-directory suffix-list... By default, the current working directory is the target directory. However, when -t option is provided, the files to be copied are located in target-directory. If target-directory is not a valid directory, then an error message is printed before exiting. Some sample runs: Case 1: backup files from current directory % backup pdf jpg copied pdf files copied jpg files tar file created ./TueJan22112241 EDT2021/archive.tar source files deleted Case 2: backup files from a target-directory % backup-t/home/users/bigFoot/pdf ppt copied pdf files copied ppt files tar file created ./TueJan 22112241EDT2021/archive.tar source files deleted Hint: you can move all your arguments ($*) into an array variable, then use an index variable to move in the array, depending on the options. Write a Bash script to back up a list of files with some given extensions. Basically the files are copied into a folder created in the target directory, named the current date. The name is a string obtained from date command, but blanks and : are removed, using tr command. E.g., Tue Jan2211 2241 EDT2021 is a valid name, obtained using date and tr. Then, all files are archived using tar utility then, the original files (the ones just copied) are removed. The name of the archive should be archive.tar Synopsis: backup [-t] target-directory suffix-list... By default, the current working directory is the target directory. However, when -t option is provided, the files to be copied are located in target-directory. If target-directory is not a valid directory, then an error message is printed before exiting. Some sample runs: Case 1: backup files from current directory % backup pdf jpg copied pdf files copied jpg files tar file created ./TueJan22112241 EDT2021/archive.tar source files deleted Case 2: backup files from a target-directory % backup-t/home/users/bigFoot/pdf ppt copied pdf files copied ppt files tar file created ./TueJan 22112241EDT2021/archive.tar source files deleted Hint: you can move all your arguments ($*) into an array variable, then use an index variable to move in the array, depending on the options

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions