1. The problem statement, all variables and given/known data:
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.
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
the command, need create a backup file/directory if not exist at /home, and inside of that directory, each copy safe(the command), create a subdirectory inside of backup, example: backup1, backup2...((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)).
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of leiria, Isla, leiria, Portugal, Unisla - Apresentação, Rosalina Pires
Last edited by pludi; 03-25-2010 at 05:33 PM..
Reason: code tags, please...
You are asked to write a command that does many things depending of prerequisites and arguments entered.
You cant just like that write a program unless you are very experienced... I mean by that :
You start by analysing what is being asked and how it can be achieved!
That part you say nothing, so start by giving us How you see it should be done through a pseudocode or algorithm, here we can already give you our point of vue and correct you if necessary, the programming itself is just transcribing correctly in a language the algorithm.
what i need to is create a command than will do a save copy each directory at line prompt through home... that is what i not understand, i m new in shell script, to safe the copy of directorys , the command need crete a new directory with the name backup inside of /home...
hints:
1)Your command reads arguments no?
You will need to be able to parse them and see one by one if they are directories...
if no argument are passed, I suppose you will have to display a "usage "message that you will do in all cases for all errors...
2)If we agree on what is to be copied, this part isnt the difficult one...
If its for today.. you are a bit late my friend...
TODO
Without a minimum of analyse and algorithm describing how you intend to do things I see not how you will be able to fullfill the task appointed to you..
You need to be clear in your head of how, that means each elementary task has been put in procedures and organized into an algorithm before thinking of coding where here the question is : "what will be the best command to achieve such task?" ...
#!/bin/bash
DIR=/dir/$(date +%y%m)
[ -d "$DIR" ] || mkdir "$DIR"
for D in $@ # obtem os argumentos/get the arguments
do
cp /usr/home/backup**
if backup=null then
mkdir backup
**thats possible??
u are right but i m working man too.. thanks to advance
Hi All,
I am having command to run which will take argument as input file. Right now we are creating the input file by cat and executing the command
ftptransfer -i input file
cat >input file
file1
file2
cntrl +d
Is there a way I can do that in a single command like
... (1 Reply)
Currently using the below script to being all compressed files .gz files from source folder and appending to the target txt file uncompressed.
Teh target txt file is getting too large in size, right now the size of the target txt file is almost 350GB
hadoop fs -text... (3 Replies)
Hello senior members,
I am a fairly newbie here. I just want to ask one question that how can once create one's own command interpreter/ shell like bash in unix/linux.
I need to execute basic commands like pipes and i/o.
Any help in this matter ?? (3 Replies)
Hello ,
I am newbie to UNIX platform .
I have read that there are two ways of creating files that is using
1.) Cat 2.) touch .
With Cat Command i am unable to create a File , i is saying No file or Directory exists
I logged in with root as user .
please help (7 Replies)
How do you write a command line that displays the number of files in the working directory with names that end with the letter S? Thanks
---------- Post updated at 09:34 PM ---------- Previous update was at 09:33 PM ----------
for unix sorry (1 Reply)
Hi all. Suppose I have the following function in an executable file named "HOLA":
------------------------
function hola { echo "Hola ${@}."; }
------------------------
In addition, suppose that I want to execute the file so I can input my name next to ./HOLA. I mean,... (4 Replies)
Hi,
I would like to develop a man page as the one we usually get when we execute man <command name>. This man page will be for a samll utility that i have written.
If this is not possible then what are the available possibilites for creating such help.
thanks in advance. (2 Replies)
hey, I'm trying to create the command that will create a file named user.txt that contains the output of the command cut -d: -f1,5 /etc/passwd, and displays itself afterwards.
I don't know how to bridge cat > user.txt with cut -d: -f1,5 /etc/passwd, or how display it afterwards. Any help would... (2 Replies)
Hi everybody in the forum,
I want to create an empty file of say some 1MB ,i mean at the command line itself.How is this possible??????EEK! (4 Replies)