VPSMATE

  • HOME
  • NEWS
  • VPS
  • DEDICATED
  • ARCHIVES
  • GoDaddy
  • SCRIPT
  • TOOLS
    • Traceroute
    • Benchmark
    • Useful Sites
  • Themes
  • GFW
VPSMATE
VPS COUPON & PROMOS | VPS & DEDICATED SERVERS OFFERS | VPS REVIEWS
Tips

One Liner to Fetch the Latest Github Release

Sometimes, it would be awfully convenient to grab the installer for the latest release of your favorite Github project directly from the command-line. And if it could incorporate awk, that would be great too.[1] Well, the following command-line is a pretty nifty template to do just that! You will need cURL, shipped with macOS, or Wget, shipped with Linux, for this to work. Substitute in the user or organization name, the project’s name, and the desired file extension for the <user>, <repo>, and <extension> fields respectively. Download the latest Github release (cURL) $ curl -s https://api.github.com/repos/<user>/<repo>/releases/latest \ | awk -F': ' '/browser_download_url/ && /\.<file extension>/ {gsub(/"/, "", $(NF)); system("curl -LO " $(NF))}' Download the latest Github release (Wget) $ wget -q -nv -O - https://api.github.com/repos/<user>/<repo>/releases/latest \ | awk -F': ' '/browser_download_url/ && /\.<file extension>/ \ {gsub(/"/, "", $(NF)); system("wget -qi -L " $(NF))}' Here is a quick explanation. First, cURL or Wget obtains the response from an HTTP GET request.[2] This response contains the URLs for the various artifacts for the latest release of the project. Next, awk processes the response, finding the line containing a download URL and matching the given file extension. It then removes the quotation marks surrounding the URL and downloads the file directly with cURL or Wget. It’s also easy enough to modify the match pattern for the file extension to make it more specific if need be. The following example demonstrates this by fetching the latest Linux release zip file of the Ninja build system. Download the latest Ninja release (cURL) $ curl -s https://api.github.com/repos/ninja-build/ninja/releases/latest \ | awk -F': ' '/browser_download_url/ && /linux\.zip/ {gsub(/"/, "", $(NF));…

16/09/2022 0comments 44hotness 0likes kyaky Read all
Archives
  • February 2023
  • September 2022
  • August 2022
  • July 2021
  • November 2020
  • September 2020
  • August 2020
  • November 2017
  • August 2017
  • July 2017
  • March 2017
  • October 2016
  • September 2016
  • June 2016
  • April 2016
  • March 2015
  • November 2014
  • October 2014
  • September 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
Highly Recommended!
Vultr
Links
Suggested Web Hosting
Suggested VPS
1.Unmetered G Port & Unlimited Backups 3.Fast Replies 4.Free credits 5.Torrent Friendly A Name You Can Trust
Digitalocean,$5/Mo-512m KVM+20GSSD

Budgetvm 1G Ram/3IP/80G/$48/yr

Photonvps/512mKVM/10GSSD/5.95$

Linode, Top Xen VPS Company

VPS.net, Top Cloud VPS Company

Domain Discounts
DMCA.com Protection Status

COPYRIGHT © 2021 vpsmate.net. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang