creating a simple archiving script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting creating a simple archiving script
# 1  
Old 12-05-2007
creating a simple archiving script

Im trying to create a script to archive specified directories into a specified tarball backup file. This is what i want the input to look like
ex. save -i '/bin/b*' -i '/bin/ls' -o backup

this is what i have
#save - backup file script
unset myInput
unset myOutput
while getopts "i: o:" myOpt
if [ $myOpt == "i" ]
myInput=$myInput" "$OPTARG
elif [ $myOpt == "o" ]
echo "[Backing up $myInput to $myOutput]"
if test -f $myOutput
echo "$myOutput already exists: must rename"
echo "Input file list: "
for file in $myInput
ls -laR "$file"
# 2  
Old 12-05-2007
A suggestion with your archiving is that you date/time stamp your files.
That way you avoid the need for the "$myOutput already exists: must rename" case.
# 3  
Old 12-05-2007
Noticed a strangely similar question [ creating an archiving script (UNIX for Dummies Questions & Answers) ]

Forum Rules:
(6) Do not post classroom or homework problems.
# 4  
Old 12-05-2007
Yup. Looks like homework. Closing the thread.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Help with creating a simple shell script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a shell script that accepts two arguments. The two arguments are the name of 2 files. • If the arguments... (3 Replies)
Discussion started by: Scripter12345
3 Replies

2. UNIX for Beginners Questions & Answers

Creating a simple ID Script

Hello everybody, :wall:I am new to Linux and I want to create a simple script on Ubuntu that will allow to make database with a few perimeters. create file and name it Database and complete it with any information id firstname lastname phone 0 1 2 3 4 ... (4 Replies)
Discussion started by: kkishore4580
4 Replies

3. Shell Programming and Scripting

Archiving files using shell script

Dear Team, I am looking for transferring files to and from the local and remote servers using SFTP commands. Currently the script is using the mget and mput commands to do the copying of the files. While I am trying to move the files from local to remote server, I would also like to archive... (21 Replies)
Discussion started by: Rads
21 Replies

4. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies

5. Shell Programming and Scripting

Simple archiving

Hi, I am a UNIX novice and was trying to write a bash script that would read two parameters, $1 would be the archive file path where the archiving path is passed, so the archiving script will write to this file path. The second parameter will be the directory path to the library which will... (0 Replies)
Discussion started by: pernuntium
0 Replies

6. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

7. UNIX for Dummies Questions & Answers

Help with creating a simple program!!

i am new to shell scripting!! i am making this program in bourne shell, that asks the user to input "Hello (their name)" or "question (their name)", any other input, "ERROR" will be outputted. if they input "Hello (name)", i want to out saying Hello (name) but if they input "question (name)", i... (4 Replies)
Discussion started by: bshell_1214
4 Replies

8. Shell Programming and Scripting

Creating simple shell program

Hi, I'm new to UNIX shell programming... can anyone help in doing the following : 1) create a text file named "Model File" having following columns : Name Number Physics Chemistry 2) prompt user to n rows enter the name, number, physics ,chemistry 3) display the entire columns and rows... (1 Reply)
Discussion started by: Mayuri P R
1 Replies

9. UNIX for Dummies Questions & Answers

creating an archiving script

Hi all. New to unix and need a little help. I am trying to create a script to archive files or directories in to a tarball. I've played a little with scripts but dont understand how to do options. What i want to be able to do is give the command any number of inputs and an output. ex.... (2 Replies)
Discussion started by: jinxe
2 Replies
Login or Register to Ask a Question