1820561 Members
2429 Online
109626 Solutions
New Discussion юеВ

Re: gzip problem

 
SOLVED
Go to solution
Hunki
Super Advisor

gzip problem

I have a script in which gzip is being called and trying to overwrite a file and I am being prompted in the following way:

0501.gz already exists; do you wish to overwrite (y or n)?

Is there a way I can circumvent this so that I donтАЩt get the prompt, I tried passing >/dev/null to the gzip command but that hangs until u press enter.
4 REPLIES 4
Geoff Wild
Honored Contributor
Solution

Re: gzip problem

Add -f to the gzip command:

-f --force
Force compression or decompression even if the file has multiple
links or the corresponding file already exists, or if the
compressed data is read from or written to a terminal. If the
input data is not in a format recognized by gzip, and if the
option --stdout is also given, copy the input data without change
to the standard ouput: let zcat behave as cat. If -f is not
given, and when not running in the background, gzip prompts to
verify whether an existing file should be overwritten.



Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
spex
Honored Contributor

Re: gzip problem

Hi Hunki,

$ gzip -f ...

PCS
A. Clay Stephenson
Acclaimed Contributor

Re: gzip problem

A "man gzip" would have revealed the -f option.
If it ain't broke, I can fix that.
Hunki
Super Advisor

Re: gzip problem

thanks Geoff / Spex. Thanks to Clay as well :)