- Use
curl
to get the JSON response for the latest release - Use
grep
to find the line containing file URL - Use
cut
andtr
to extract the URL - Use
wget
to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
Love a good one-liner.
If you must use
wget
, to make your life easier you should search for your architecture by matchinguname -m
from the JSON response. Don't forget to addhead -1
though, otherwise you're (silently) downloading packages for all available archs.Totally up to you, but you may want to show progress too (albeit omitting everything else) with
-q --show-progress
instead of suppressing all output.The one-liner would look something like this:
Note: Setting a variable with the user/repo should decrease the risk of messing up the url :)