Created
May 20, 2017 21:33
-
-
Save mnewt/b076b6fa05f80eb7ac64684fc943ee7d to your computer and use it in GitHub Desktop.
Revisions
-
mnewt created this gist
May 20, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/sh # Download a github project's latest release # $1: username/repo # $2: regex to match download file # example: ./gh-download-latest atom/atom gz repo=$1 regex=${2:-gz} wget -qO- https://api.github.com/repos/$repo/releases/latest | \ awk -v regex="$regex" -F '"' '/browser_download_url/ && match($4, regex) { print $4 }' | \ xargs wget