From 2e3fa58e30dfc78b2f8bc26fe7afb2a56a7b7bf7 Mon Sep 17 00:00:00 2001 From: Henric Andersson Date: Wed, 31 Aug 2016 07:09:08 -0700 Subject: [PATCH] Added -m1 to last grep in RELEASe We cannot handle the case where our filtering ends up with multiple results at the very end, so make sure grep only returns the first match. Fixes #99 --- plexupdate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexupdate.sh b/plexupdate.sh index 3d55aad..a459d0c 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -454,7 +454,7 @@ fi echo -n "Finding download URL to download..." # Set "X-Plex-Token" to the auth token, if no token is specified or it is invalid, the list will return public downloads by default -RELEASE=$(wget --header "X-Plex-Token:"${TOKEN}"" --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${URL_DOWNLOAD}" -O - 2>/dev/null | grep -ioe '"label"[^}]*' | grep -i "\"distro\":\"${DISTRO}\"" | grep -i "\"build\":\"${BUILD}\"") +RELEASE=$(wget --header "X-Plex-Token:"${TOKEN}"" --load-cookies /tmp/kaka --save-cookies /tmp/kaka --keep-session-cookies "${URL_DOWNLOAD}" -O - 2>/dev/null | grep -ioe '"label"[^}]*' | grep -i "\"distro\":\"${DISTRO}\"" | grep -m1 -i "\"build\":\"${BUILD}\"") DOWNLOAD=$(echo ${RELEASE} | grep -m1 -ioe 'https://[^\"]*') CHECKSUM=$(echo ${RELEASE} | grep -ioe '\"checksum\"\:\"[^\"]*' | sed 's/\"checksum\"\:\"//') echo "OK"