- Use
curlto get the JSON response for the latest release - Use
grepto find the line containing file URL - Use
cutandtrto extract the URL - Use
wgetto 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 -
/latest did not contain a browser_download_url for me, so I had to go a different route:
In the first two steps the url is extracted from the json line by cleaning it up with grep, cut, and sed.
xargs strips the space and feeds the extracted clean URL to curl again.
The final curl also sets the desired filename for the latest release.