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

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I need to do a work to my job, but i m new in script shell, someone can help with this..
# 1  
Old 03-25-2010
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.. Smilie


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.


Last edited by vbe; 03-25-2010 at 01:50 PM.. Reason: Read the rules again - About the Title of new post!
# 2  
Old 03-25-2010
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 :
DIR=base/path/of/your/backup/dir/$(date +%y%m)
[ -d "$DIR" ] || mkdir "$DIR"
for D in $@ # gets the arguments of the command line
    cp -av ~/"$D" "$DIR/$D"

# 3  
Old 03-25-2010
I could be wrong, but that sounds a lot more like homework than a task delegated by a boss.
# 4  
Old 03-25-2010
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
# 5  
Old 03-25-2010
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help with a Shell Script for a Job

Hi Guys, I need your help with setting up a shell script for the following job. Please help. Encrypted file received at the SFTP server (.55 network - DMZ) from ABC company Encrypted file is passed into the internal network (.52 or .53) in one of the system and comes to Folder 'A' A script... (8 Replies)
Discussion started by: sam0912
8 Replies

2. Shell Programming and Scripting

Shell script to work on dates

Hi Sir/Madam I have a file data.txt like below file_name date_of_creation x 2/10/2012 y 8/11/2010 z 11/3/2013 a 2/10/2013 b 3/10/2013 c ... (4 Replies)
Discussion started by: kumar85shiv
4 Replies

3. UNIX for Dummies Questions & Answers

How to work command 'cd' in shell script?

I have simple script. like that, I am working on /usr/local/src and also under src folder there is a ft folder #!/bin/ksh #!/bin/bash dirpath="/usr/local/src/ft" echo $dirpath cd $dirpath echo displays ok "/usr/local/src/ft" but that doesn't enter "ft" folder. stays in current... (4 Replies)
Discussion started by: F@NTOM
4 Replies

4. AIX

AIX Shell script does not work

Hi. I created schell script for sending messages to some processes in AIX: #!/bin/sh BSE=/infor/ERPLN/bse BSE_TMP=/infor/ERPLN/bse/tmp export BSE BSE_TMP for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "` do /something $i done Unfortunatelly this script does not work on... (6 Replies)
Discussion started by: giovanni
6 Replies

5. Shell Programming and Scripting

Exit Shell Script with background job

Hi all, I am trying to exit a shell script (c shell) while invoking a job (service) that must run in the background: ...... /mydir/runservice & exit ...... There are downstream jobs and scripts that need to be run, but they all 'wait' for the script to exit. The script 'hangs' and... (3 Replies)
Discussion started by: CKT_newbie88
3 Replies

6. UNIX for Dummies Questions & Answers

cron job for the created shell script

Hi am newbie for unix shell.. how to create a cron job for my already created shell script.:confused: Thanks! (1 Reply)
Discussion started by: vidhyaS
1 Replies

7. Shell Programming and Scripting

SSH shell script does not work

Hello I have a Zabbix Server were Linux kernel version 2.6.26-2-amd64 is running. now my Question how can i make a script that does: - connect with ssh to a device - get the systeminfo (but only the interfaces, mac adresses, serialnumber and Software version) - write the output in a file ... (18 Replies)
Discussion started by: Fraggy
18 Replies

8. UNIX for Dummies Questions & Answers

Job Status for running shell script

Hello, I am running a shell script whose execution often takes several hours to complete. Is there way I can get some kind of status update as the job is running? Something as simple as the start and the current time stamp. Thanks, Gussi (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

9. Shell Programming and Scripting

Cron job shell script..

Hey Guys, i was trying out a shell script which has to remove a file for every 90 mins. this is the code i came up with . $ crontab -e file1 file1 contains 30 1 * * * * rm -r /folder1/folder2/somefile.txt Now i need the cron to run for every 90 mins. the problem with this is... (8 Replies)
Discussion started by: Irishboy24
8 Replies

10. Shell Programming and Scripting

Multiple instances of the job in shell script.

Hi, Please let us know how to create a multiple instances of a job in the shell script. Thanks. Gangegowda K.G (1 Reply)
Discussion started by: Gangegowda
1 Replies
Login or Register to Ask a Question

Featured Tech Videos