Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to pipe the result of wget to tar

I’m trying to create a command that would download the latest .gz file and install on my container in Dockerfile. I came up with this but I can’t seem to get it working.

curl -s https://api.github.com/repos/fullstorydev/grpcurl/releases/latest | grep 'linux_arm64.tar.gz' | cut -d : -f 2,3 | tr -d \" | wget -qi - | sudo tar -C /usr/local/bin -xz;

I always get this error

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Like this:

file=$(
  curl -s https://api.github.com/repos/fullstorydev/grpcurl/releases/latest |
    jq -r '.assets | .[] | select(.browser_download_url | contains("linux_arm64")) .browser_download_url'
)
wget -O- "$file" | tar zxvf - | sudo tee /usr/local/bin/grpcurl
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading