I am trying to download some .gz
files (N.B. not .tar.gz
ones) from given URLs and decompress them to overwrite existing files, if any.
For each individual download, I tried the following:
curl -O $URL | gunzip -f
However, this did not work as it failed with: gzip: stdin: unexpected end of file
. I ran a series of this command inside a bash shell script.
If I spilt the command into two explicit steps, i.e. first download the file, and then decompress the .gz
file, it works.
Why the piped version does not work?
curl -O
actually streams the file to standard output? Perhaps you are thinking ofwget -O-
?--compressed
, but this works only for a compressed responses.