Re: Why can redirection be combined in an assignment statement?
From:
Peng Yu
Subject:
Re: Why can redirection be combined in an assignment statement?
Date:
Mon, 10 May 2021 11:16:59 -0500
> $ reverse=false; if "$reverse"; then a=$(rev); else a=$(cat); fi
> <<<"hello"; echo "$a"
> hello
> $ reverse=true; if "$reverse"; then a=$(rev); else a=$(cat); fi
> <<<"hello"; echo "$a"
> olleh
I am talking about combining just assignment and redirection, which
comes from these rules.
simple_command_element: WORD
| ASSIGNMENT_WORD
| redirection
;
simple_command: simple_command_element
| simple_command simple_command_element
;
Your example is not about this case. Therefore, it does not serve the
purpose of justifying combining assignment and redirection.
--
Regards,
Peng