Why does the following code give me the error in the title?
_say_hey()
{
echo "hey"
}
echo "$(_say_hey())"
When calling a function, call it like an ordinary command (leave off the brackets):
echo "$(_say_hey)"
Note that the echo
here is redundant; you could just write _say_hey
on a line by itself for the same effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With