3
\$\begingroup\$

I want to get the latest release of certain package. In order to do so I did this:

wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -O /tmp/chromedriver_release
wget http://chromedriver.storage.googleapis.com/`cat /tmp/chromedriver_release`/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
  • There's not a direct link to the latest version (at least none that I could find)
  • This instructions are part of a provisioning script, I don't have curl installed and I don't want to install it

I checked wget arguments and I didn't find anything that allows me to redirect the downloaded content to stdout. Will this be my best option?

\$\endgroup\$
2
\$\begingroup\$

This is very hard to read like that. The duplication of the same base url is also not great.

With the -O flag, you could specify - to make the output go to stdout.

Lastly, `...` is obsolete syntax, use the modern $(...) instead.

baseurl=https://chromedriver.storage.googleapis.com
filename=chromedriver_linux64.zip

version=$(wget "$baseurl"/LATEST_RELEASE -O-)
wget "$baseurl/$version/$filename" -O "/tmp/$filename"
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.