- 论坛徽章:
- 0
|
1. You are required to write a backup linux bash script.
The script should ask the user a directory to backup. It should then go and search the users home directory for existence of that directory. If it is found it should tar/gzip all the files and directories in that directory preserving the directory structure in a file named with the directory name and a appended integer. It should store the tarred file in a directory called backups in the home directory. Each time the script is run, it should make a tar file with the directory name and an appended incremented digit.
Eg. Filenames could be myfiles1.tar.gz, myfiles2.tar.gz, mypictures4.tat.gz
You do not need to increment sequentially the files for each directory although those who are under-worked may do so.
If multiple occurrences of the directory are found then the script should output all the occurrences of the directories and the user the particular directory that needs to be backed up. Read the in the new particular directory that needs to be backed up and back it up as above.
If the directory does not exist the exit with an appropriate message. |
|