- bash: command substitution: line XX: syntax error: unexpected end of file

Why does the following code give me an error in the header?

_say_hey()
{
    echo "hey"
}
echo "$(_say_hey())"
+5
source share
1 answer

When calling a function, call it like a normal command (leave it without parentheses):

echo "$(_say_hey)"

Note that echohere is redundant; you could just write _say_heyline by line for the same effect.

+7
source

All Articles