commit 59656d66bb21a7b83d6e04fd6db59d09fee356e4
parent b88dffeba3b0f1c4e553ba8bbfe8e5ad6fb12fd5
Author: Brian Mayer <bleemayer@gmail.com>
Date: Thu, 22 Jul 2021 23:04:19 -0300
Improved proto parsing
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/astro b/astro
@@ -44,11 +44,12 @@ parseurl() {
if [ "$proto" ]
then
- url="$(echo "$url" | sed -e "s/$proto//g")" # remove the protocol
+ url="$(echo "$url" | sed -e "s@$proto@@g")" # remove the protocol
else
url="$1"
fi
[ "$debug" ] && echo "url: $url" >&2 && sleep 2
+
proto="$(echo "$proto" | sed -e 's,:\?//,,g')"
user="$(echo "$url" | grep @ | cut -d@ -f1)" # extract the user (if any)
hostport="$(echo "$url" | sed -e "s/$user@//g" | cut -d/ -f1)" # extract the host and port