I need to do a work to my job, but i m new in script shell, someone can help with this..

I need to do a work to my job, but i m new in script shell, someone can help with this.. :confused:

Description

Bsafe The command creates a backup directory of each month at the command line (arguments of the script). The names of directories to copy will always be specified for the home user. To save copies of the script uses a specific directory, now called the backup directory. If the backup directory does not exist, the script should create it. Within the backup directory, the script should create a directory for each backup done (use a different name every time). Within this directory (the copy of the instant), each directory passed as argument of the script should be copied, including sub-directories and files, preserving dates and times of access and modification of them. Of course, the backup directory should not be copied into itself.

 Thanks

Do you have an idea of where to put that backup directory (should it be in the user's home?) what name you want to give to the different subdirs (date? year-month?).
Should all the files be copied or only the modified ones?

Using cp, something like :

#!/bin/bash
DIR=base/path/of/your/backup/dir/$(date +%y%m)
[ -d "$DIR" ] || mkdir "$DIR"
for D in $@ # gets the arguments of the command line
do
    cp -av ~/"$D" "$DIR/$D"
done

I could be wrong, but that sounds a lot more like homework than a task delegated by a boss.

I could be wrong, but that sounds a lot more like homework than a task delegated by a boss.U are right, a could say nothing about, but thats true, a need some help, i just need understand some " function" with script shells, its a help..

---------- Post updated at 07:33 PM ---------- Previous update was at 07:32 PM ----------

thanks to Tony

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.