Skip to content

Instantly share code, notes, and snippets.

@ozh
Created April 24, 2013 15:46
Show Gist options
  • Save ozh/5453165 to your computer and use it in GitHub Desktop.
Save ozh/5453165 to your computer and use it in GitHub Desktop.
BASH: get latest tag from a project
#!/bin/bash
json=`curl -s -X GET https://api.github.com/repos/YOURLS/YOURLS/tags`
prop='name'
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo $temp | cut -d\ -f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment