This question is related to Bash. The following is working in terminal:
url="http://user:pw@example.com:80/"
echo $url | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/'
Terminal output: example.com
How to fix the following?
domain=$($url | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/') # not working
echo $domain
echo
indomain=$(echo "$url" | ...)
; and please do not duplicate your question of https://unix.stackexchange.com/q/624145/72456 – αғsнιη Dec 12 '20 at 19:32