Re: zip /gzip in bash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
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@xxxxxxxxx>:
> 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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
>> 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@xxxxxxxxxxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux