Skip to content

Instantly share code, notes, and snippets.

@ozh
Created April 24, 2013 15:58
Show Gist options
  • Select an option

  • Save ozh/5453263 to your computer and use it in GitHub Desktop.

Select an option

Save ozh/5453263 to your computer and use it in GitHub Desktop.
BASH: fetch latest stable YOURLS readme.html
#!/bin/bash
cd ~/yourls.org
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`
tag=`echo $temp | cut -d\ -f3`
rm -f readme.html && curl -s https://raw.github.com/YOURLS/YOURLS/$tag/readme.html -o readme.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment