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.

Required fields*

2
  • 2
    x=a; x=b echo $x why $x is a? according to your answer, it should be b! Commented Oct 28, 2020 at 16:02
  • 2
    x=b only within the echo command (whether builtin or binary). The $x substitution is performed well before that, in the shell. For example perl sees the environment variable as set to b x=a; x=b perl -e 'print $ENV{"x"}; print "\n"' but will print a if the substitution is done at time of invocation of course! x=a; x=b perl -e "print qq($x\n);" Commented Nov 2, 2020 at 0:15