Currently I have a script that sets compression using the GZIP
environment variable.
With gzip 1.8 I get a warning:
warning: GZIP environment variable is deprecated; use an alias or script
How should tar be invoked so the compression level be set?
Current command:
GZIP=-9 tar -zcf
... files to compress ...
Some older versions of tar do support the -I
option to specify a compression command, however the older versions of tar do not support additional arguments to the compressor command. So older versions break when using something like -I 'gzip -9'
.
A more portable and reliable solution is to handle the compression yourself with a pipe as mentioned in the other answer.
You can specify the compression program using: -I
/ --use-compress-program=COMMAND
.
So the original command:
GZIP=-9 tar -zcf
... files to compress ...
Becomes:
tar -I 'gzip -9' -cf
... files to compress ...
From this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With