diff --git a/.local/bin/rssadd b/.local/bin/rssadd index fb60be8..910fca3 100755 --- a/.local/bin/rssadd +++ b/.local/bin/rssadd @@ -1,12 +1,12 @@ #!/bin/sh -if echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null; then +if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ; then url="$1" else url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" | - sed -E 's_^.*href="(https?://[^"]+)".*$_\1_')" + grep -o "https?://[^\" ]")" - ! grep "https*://\S\+\.[A-Za-z]\+\S*" <<<"$url" && + echo "$url" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" || notify-send "That doesn't look like a full URL." && exit 1 fi