It's a subtle point.  See this paragraph in the bash manual page:

       If there is a command name left after expansion, execution
       proceeds as described below.  Otherwise, the command exits.  If
       one of the expansions contained a command substitution, the exit
       status of the command is the exit status of the last command
       substitution performed.  If there were no command substitutions,
       the command exits with a status of zero.

In one of your examples, a "local" command is generated using a command
substitution, so the exit status is that of the local command.  In the
other, only an assignment is done, which is not a command, so the exit
status is that of the last command substitution.

Dale

Reply via email to