- 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 -
curl -o filename.tgz -L `curl -s https://api.github.com/repos/USER/REPO/releases/latest | grep -oP '"tarball_url": "\K(.*)(?=")'`
there will be a container directory inside this. You can find its name like:
export hash=`curl -s https://api.github.com/repos/ImageMagick/ImageMagick/releases/latest | grep -oP '"target_commitish": "\K(.*)(?=")'`
export dir = USER-REPO-${hash::7}
so if you
tar -zxf filename.tgz
after the first curl, you can thencd $dir
and then work with the files...