Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Very good explanation. I tried something: # a=1;a=2;a=3 | echo $a (outputs 2). So, It got second 'a' value in the output, and not the first one. @pizdelect Commented Mar 10, 2020 at 13:23
  • The ; has lower precedence than |. You're not fooling the parser by huddling the assignments close together -- the parser will still group it as a=1; a=2; { a=3 | echo $a; }, not as { a=1; a=2; a=3; } | echo $a. Just like 4+4 / 2 is 6 not 4 Commented Mar 11, 2020 at 16:43
  • Got your point ! It should be considered precedence order in command execution by Bash Commented Mar 12, 2020 at 15:14