This question is related to Bash. The following is working in terminal:
url="http://user:[email protected]: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