Created
November 13, 2014 10:10
-
-
Save unascribed/e4bfddf7226d30bf40c8 to your computer and use it in GitHub Desktop.
This file contains 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 characters
if [ "$DESIRED_RELEASE" == "recommended" ]; then | |
# this is unholy, but Forge doesn't appear to supply an API, and | |
# their Maven repo appears to not be well formed | |
DESIRED_RELEASE=`curl -s http://files.minecraftforge.net/ | | |
grep -m 1 -A 2 '<td>Recommended' | | |
grep -v 'Recommended' | | |
cut -d '>' -f 2 | | |
cut -d '<' -f 1 | | |
tac | | |
head -c -1 | | |
tr '\n' '-'` | |
# so, here's what we just did | |
# curl gets the main forge files page, that should be obvious | |
# the first grep looks for the 'Recommended' build line | |
# the -m 1 makes it give up when it finds it, which cancels curl | |
# this prevents us from downloading the whole page | |
# the two cuts get rid of the td tags and their closers | |
# tac reverses it so that it's like a forge version | |
# head removes the trailing newline | |
# tr turns the newlines into dashes | |
# we now have a valid forge version number | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment