On Sun, Jul 2, 2023, at 8:30 PM, Dan Jacobson wrote:
> man page says:
>
> A variable may be assigned to by a statement of the form
>
> name=[value]
>
> If value is not given, the variable is assigned the null string. All
> values undergo tilde expansion, parameter and variable
> expansion...
>
> OK, but do please mention somewhere that "if the variable is set more
> than once within the same statement, the final value is used."
>
> $ m=1 m=2; echo $m
> #(Yes, acts the same as:)
> $ m=1; m=2; echo $m
This is stated under "Simple Command Expansion".
When a simple command is executed, the shell performs the
following expansions, assignments, and redirections, from
left to right, in the following order.
[...]
4. The text after the = in each variable assignment undergoes
tilde expansion, parameter expansion, command substitution,
arithmetic expansion, and quote removal before being
assigned to the variable.
https://www.gnu.org/software/bash/manual/html_node/Simple-Command-Expansion.html
--
vq