$(echo a) is a "command substitution". The
$(...) will be replaced by the output of the command within. The output in this case is
a, which the shell then tries to execute. The shell can't locate the command called
a and you get the error message.
It is unclear what your intention with this was or what you expected to happen. It is highly unusual to want to execute the result of a command substitution.
Some programs output strings that should be evaluated by the shell. It is therefore possible to see code like
which evaluates (runs) the output of the given command. These commands have a strictly specified output and are generally considered safe to run in this way. In the example above,
ssh-agent will start the SSH agent process and output a few commands that will set the appropriate environment variables that the
ssh client later will need for using the agent, for example,
SSH_AUTH_SOCK=/tmp/ssh-Ppg1EO5eRIZp/agent.6017; export SSH_AUTH_SOCK;
SSH_AGENT_PID=6018; export SSH_AGENT_PID;
echo Agent pid 6018;
This is then evaluated by
eval is used here rather than just simply using
$(ssh-agent) since the output of the
ssh-agent command is more a compound command. Without
; command terminators would net be special.
$ s='echo hello; echo world'
hello; echo world
$ eval "$s"