I've been trying to extract the substring in between parentheses (including parentheses) from:
"WHITE-TAILED TROPIC-BIRD _Phaëthon lepturus_ (Hawaiian name—koae)"
I tried this:
str=$(echo $1 | sed 's/.*\(\([^)]*\)\).*/\1/');
echo $str
What I wanted to get was:
"(Hawaiian name—koae)"
However, I've been getting an error called:
bash: syntax error near unexpected token `('
What do I do wrong?