summaryrefslogtreecommitdiffstats
path: root/util/t/uriparse/parse-url
blob: 2ccf39c9caa405b6382d86532fcb53fa56a27146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
set -euf
tempfile="`mktemp /tmp/test.XXXXXXXX`"
trap "/bin/rm -f $tempfile" EXIT INT

uriparse "http://user:pass@domain.tld/path" > $tempfile
. $tempfile
[ "$HOSTN" = "domain.tld" ] && \
    [ $USERNAME = "user" ] && \
    [ $PASSWORD = "pass" ] && \
    [ $URIPATH  = "/path" ]