Created
January 27, 2020 17:18
-
-
Save inolen/75a836f48a2e54d8d4bd5bf3d9e79856 to your computer and use it in GitHub Desktop.
redream latest url
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
#!/bin/bash | |
get_latest_url() { | |
local REDREAM_URL=https://redream.io | |
local REDREAM_TARGET=aarch32-raspberry-linux | |
wget -qO /tmp/redream-download.html ${REDREAM_URL}/download | |
local links=$( \ | |
grep -E 'href="([^"]*redream.'$REDREAM_TARGET'[^"]+)' /tmp/redream-download.html | \ | |
sed -E 's/.*href="([^"]*redream.'$REDREAM_TARGET'[^"]+)".*/\1/g' | \ | |
uniq \ | |
) | |
rm /tmp/redream-download.html | |
local latest=$(echo "$links" | head -n1) | |
echo ${REDREAM_URL}${latest} | |
} | |
LATEST_URL=$(get_latest_url) | |
echo $LATEST_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment