zip /gzip in bash

xinyou yan yxy.716 at gmail.com
Wed Aug 31 12:38:11 UTC 2011


Yes I can.
Howerver I want to append  another file  in another time

May be  I need write a scitpt to do it .

I just wonder , whether  have a easy way to do it.

在 2011年8月31日 下午7:28,j.e.aneiros <jesus.aneiros at gmail.com> 写道:
> 2011/8/31 xinyou yan <yxy.716 at gmail.com>
>>
>> HI:
>>
>> How can i use use gzip to compress and tar to append the other file:
>>
>> here is is a testcase :
>>
>>
>> file :test1 test2
>>
>> :~/testtar # tar -czf  1.tar.gz test1
>> :~/testtar # tar -rzf 1.tar.gz test2
>
> Could you use tar czf 1.tar.gz test1 test2 ?
>
>>
>> tar: Cannot update compressed archives
>> Try `tar --help' or `tar --usage' for more information.
>>
>> However tar -cf
>>             tar -rf  can work fine.
>>
>> I am thinking find a way useing gzip to compress and tar    then and
>> need to append any time .
>>
>> Thank you
>>
>>
>>
>> 2011/8/31 j.e.aneiros <jesus.aneiros at gmail.com>:
>> > Hi,
>> > gzip is a compressor, not an archiver as tar. zip is an archiver and
>> > compressor. So maybe you could use tar with the z option to compress?
>> >
>> > Best regards, --janeiros.
>> > On Tue, Aug 30, 2011 at 12:57 PM, xinyou yan <yxy.716 at gmail.com> wrote:
>> >>
>> >> Hi every one ,
>> >>
>> >>   I was confuse to use gzip in shell.
>> >>   You see below.  I can use zip -gj  make test.tar include the
>> >> testfile  and the test1file
>> >>   However  , use gzip  make the test_gzip.tar.gz NULL.
>> >>   I see man and use gzip -c file >> tarname.  to add a file to a tar
>> >> file
>> >> .
>> >>   Can anyone tell me why?
>> >>   You can let  /root have two sample file  testfile test1file
>> >>
>> >>
>> >> #!/bin/sh
>> >>
>> >> anse='/root/test.tar'
>> >> anse_gzip='/root/test_gzip.tar.gz'
>> >> test='/usr/local/sbin/testfile'
>> >> test1='/usr/local/sbin/test1file'
>> >>
>> >> zip -gj $anse $test
>> >> zip -gj $anse $test1
>> >>
>> >> gzip -c $test >> $anse_gzip
>> >> gzip -c $test1 >> $anse_gzip
>> >>
>> >> I think gzip can do what zip can do in linux .
>> >>
>> >> If I just  do
>> >> gzip -c testfile >> test_gzip.tar.gz
>> >>
>> >> It can create the test_gzip.tar.gz file But can't include any file .
>> >>
>> >>
>> >>
>> >> --
>> >> ----------------------------------------------------------------
>> >> 嘉谟之行
>> >> "昔我往矣,杨柳依依 ; 今我来思 ,雨雪霏霏"
>> >> ----------------------------------------------------------------
>> >> --
>> >> users mailing list
>> >> users at lists.fedoraproject.org
>> >> To unsubscribe or change subscription options:
>> >> https://admin.fedoraproject.org/mailman/listinfo/users
>> >> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>> >
>> >
>> >
>> > --
>> > J. E. Aneiros
>> > GNU/Linux User #190716 en http://counter.li.org
>> > perl -e '$_=pack(c5,0105,0107,0123,0132,(1<<3)+2);y[A-Z][N-ZA-M];print;'
>> > PK fingerprint: 5179 917E 5B34 F073 E11A  AFB3 4CB3 5301 4A80 F674
>> >
>> > --
>> > users mailing list
>> > users at lists.fedoraproject.org
>> > To unsubscribe or change subscription options:
>> > https://admin.fedoraproject.org/mailman/listinfo/users
>> > Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>> >
>> >
>>
>>
>>
>> --
>> ----------------------------------------------------------------
>> 嘉谟之行
>> "昔我往矣,杨柳依依 ; 今我来思 ,雨雪霏霏"
>> ----------------------------------------------------------------
>> --
>> users mailing list
>> users at lists.fedoraproject.org
>> To unsubscribe or change subscription options:
>> https://admin.fedoraproject.org/mailman/listinfo/users
>> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>
>
>
> --
> J. E. Aneiros
> GNU/Linux User #190716 en http://counter.li.org
> perl -e '$_=pack(c5,0105,0107,0123,0132,(1<<3)+2);y[A-Z][N-ZA-M];print;'
> PK fingerprint: 5179 917E 5B34 F073 E11A  AFB3 4CB3 5301 4A80 F674
>
> --
> users mailing list
> users at lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>
>



-- 
----------------------------------------------------------------
嘉谟之行
"昔我往矣,杨柳依依 ; 今我来思 ,雨雪霏霏"
----------------------------------------------------------------


More information about the users mailing list