Sponsored Content
Full Discussion: Programming newbie -help!!
Top Forums Shell Programming and Scripting Programming newbie -help!! Post 302714215 by Arun_Linux on Friday 12th of October 2012 02:02:42 AM
Old 10-12-2012
Every time the loop runs, it creates the tar file in the same name (backup.tar.gz) thus over writing the previous one, hence it ends up only with the last tared file.
The tar command in your while loop should have variable for both source and destination.

Try this:

Code:
cat test.txt |
(
while read line
do
tar -czPf  backup_$line.tar.gz  $line
done
)

 

10 More Discussions You Might Find Interesting

1. Programming

programming question from a newbie, please help

Hi Everyone, I really hope I could get some insight from a few of you, I've been searching the net for various resources, and this board seems to be the friendliest and most helpful by far. I work for a medical research company and we use sun 4 and we have different studies that have their... (1 Reply)
Discussion started by: milenky
1 Replies

2. UNIX for Dummies Questions & Answers

Programming Newbie Chick

OK, so I'm trying to finish my last individual assignment for this course, and it's the first time I've visited a forum (I've actually understood UNIX up to this point). I am having trouble with this one. I have to write a program that prompts the user to type their first name and stores it in a... (3 Replies)
Discussion started by: metalgoddess21
3 Replies

3. Programming

newbie to unix programming in C, needed a few simple prgs on these functions!

Hi all, I am a newbie to unix programming using C.. So i would like to have a few simple C programs to start off with.. I wanted programs on learning , abort,kill and raise,alarm and pause,I would also like to know how to use the vfork() in a prg It would be really great if i can have... (1 Reply)
Discussion started by: wrapster
1 Replies

4. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

5. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

6. Shell Programming and Scripting

perl newbie . &&..programming newbie (question 2)

Hello everyone, I am having to do a lot of perl scripting these days and I am learning a lot. I have this problem I want to move files from a folder and all its sub folders to one parent folder, they are all .gz files.. there is folder1\folder2\*.gz and there are about 50 folders... (1 Reply)
Discussion started by: xytiz
1 Replies

7. Shell Programming and Scripting

perl newbie . &&..programming newbie

Hi, I am new to programming and also to perl..But i know 'perl' can come to my rescue, But I am stuck at many places and need help..any small help is much appreciated... below is the description of what i intend to acheive with my script. I have a files named in this format... (13 Replies)
Discussion started by: xytiz
13 Replies

8. Fedora

Newbie at Linux Kernel programming!

Hi Friends, This is my first ever post on this forum. I am a new user in the Linux field. Although, I have been working for sometime with CentOS at my work, I would consider myself an amateur only in this field. :D The way file system works in linux and the reason its open-source, has really... (7 Replies)
Discussion started by: rohitrajjain
7 Replies

9. UNIX for Dummies Questions & Answers

Newbie needs help with Xlib / X11 programming,dunno who to ask,but you :(

Hi,I'm new here and to Unix also. I'm totall newbie. Here is what I have to do: -Basics of programming user interface with Xlib library -Xlib -Client/Server model of X-Windows system -Example of "Hello world" with button which changes text ,so that when u click displays another... (4 Replies)
Discussion started by: megane16v
4 Replies

10. UNIX for Dummies Questions & Answers

From iOS programming to Linux system programming

Hello. I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations: 1. Linux and iOS are UNIX-like systems, POSIX compliant. 2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies
ARCHIVE_WRITE_FILTER(3) 				   BSD Library Functions Manual 				   ARCHIVE_WRITE_FILTER(3)

NAME
archive_write_add_filter_bzip2, archive_write_add_filter_compress, archive_write_add_filter_gzip, archive_write_add_filter_lzip, archive_write_add_filter_lzma, archive_write_add_filter_none, archive_write_add_filter_program, archive_write_add_filter_xz LIBRARY
Streaming Archive Library (libarchive, -larchive) SYNOPSIS
#include <archive.h> int archive_write_add_filter_bzip2(struct archive *); int archive_write_add_filter_compress(struct archive *); int archive_write_add_filter_gzip(struct archive *); int archive_write_add_filter_lzip(struct archive *); int archive_write_add_filter_lzma(struct archive *); int archive_write_add_filter_none(struct archive *); int archive_write_add_filter_program(struct archive *, const char * cmd); int archive_write_add_filter_xz(struct archive *); DESCRIPTION
archive_write_add_filter_bzip2(), archive_write_add_filter_compress(), archive_write_add_filter_gzip(), archive_write_add_filter_lzip(), archive_write_add_filter_lzma(), archive_write_add_filter_xz(), The resulting archive will be compressed as specified. Note that the compressed output is always properly blocked. archive_write_add_filter_none() This is never necessary. It is provided only for backwards compatibility. archive_write_add_filter_program() The archive will be fed into the specified compression program. The output of that program is blocked and written to the client write callbacks. RETURN VALUES
These functions return ARCHIVE_OK on success, or ARCHIVE_FATAL. ERRORS
Detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions. SEE ALSO
tar(1), libarchive(3), archive_write(3), archive_write_format(3), archive_write_set_options(3), cpio(5), mtree(5), tar(5) BSD
February 2, 2012 BSD
All times are GMT -4. The time now is 11:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy