Re: set -e not ignored in AND-OR list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey.

On November 24, 2024 12:58:27 PM GMT+01:00, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>It's simple really, POSIX says:
>
>	or any command of an AND-OR list other than the last.
>
>The word "command" refers to the commands that make up the AND-OR
>list.  Command substitution is not part of that at all.

AFAIU, an assignment with a command substitution as well as a lone command substitution, is just a simple command, as follows from 2.9.1 Simple Commands.
Which are then one kind of command, as follows from 2.9 Shell Commands.


That also follows from the grammar:

Command substitutions are quite clearly word expansions and thus words.

cmd_name : WORD /* Apply rule 7a */ ;
cmd_word : WORD /* Apply rule 7b */ ;
cmd_prefix : io_redirect | cmd_prefix io_redirect | ASSIGNMENT_WORD | cmd_prefix ASSIGNMENT_WORD;
cmd_suffix : io_redirect | cmd_suffix io_redirect | WORD | cmd_suffix WORD ;

Which then form simple commands:

simple_command : cmd_prefix cmd_word cmd_suffix | cmd_prefix cmd_word | cmd_prefix | cmd_name cmd_suffix | cmd_name

Which form commands:

command : simple_command | compound_command | compound_command redirect_list | function_definition

Which form:

pipe_sequence : command | pipe_sequence '|' linebreak command

Those then pipelines:

pipeline : pipe_sequence | Bang pipe_sequence

And those in turn, the AND-OR lists:

and_or : pipeline | and_or AND_IF linebreak pipeline | and_or OR_IF linebreak pipeline

If don't see how that could be interpreted as command substitutions not being part of that.


Cheer, 
Chris. 





[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux