#!/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" ]