here string removed

This commit is contained in:
Luke Smith 2021-04-07 11:46:50 -04:00
parent 20c1eada6f
commit afaca0a0b6
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -1,12 +1,12 @@
#!/bin/sh #!/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" url="$1"
else else
url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" | 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 notify-send "That doesn't look like a full URL." && exit 1
fi fi