4 ms·
>Note, however, that "$(( x=5 ))" need not be equivalent to "$(( $x=5 ))" . If the value of the environment variable x is the string "y=" , the expansion of "$(
by ykonstant 2y ago
>Note, however, that "$(( x=5 ))" need not be equivalent to "$(( $x=5 ))" . If the value of the environment variable x is the string "y=" , the expansion of "$(( x=5 ))" would set x to 5 and output 5, but "$(( $x=5 ))" would output 0 if the value of the environment variable y is not 5 and would output 1 if the environment variable y is 5. Similarly, if the value of the environment variable is 4, the expansion of "$(( x=5 ))" would still set x to 5 and output 5, but "$(( $x=5 ))" (which would be equivalent to "$(( 4=5 ))" ) would yield a syntax error.
Ah, never change, Unix shells :) I still love this bonkers language.