mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
81dd4a4536
Prior to this fix, a "bare variable" in math like 'x + 1' would be looked up in the environment, i.e. equivalent to '$x + 1'. This appears to have been done for performance. However this breaks the orthogonality of fish; performance is not a sufficient justification to give math this level of built-in power, especially because the performance of math is not a bottleneck. The implementation is also ugly. Remove this feature so that variables must be prefixed with the dollar sign and undergo normal variable expansion. Reading 'git grep' output does not show any uses of this in fish functions or completions. Also added to changelog. Fixes #4393
24 lines
389 B
Fish
24 lines
389 B
Fish
logmsg Validate basic expressions
|
|
math 3 / 2
|
|
math 10/6
|
|
math -s0 10 / 6
|
|
math -s3 10/6
|
|
math '10 % 6'
|
|
math -s0 '10 % 6'
|
|
math '23 % 7'
|
|
math --scale=6 '5 / 3 * 0.3'
|
|
math "7^2"
|
|
math -1 + 1
|
|
math '-2 * -2'
|
|
math 5 \* -2
|
|
math -- -4 / 2
|
|
math -- '-4 * 2'
|
|
|
|
logmsg Validate how variables in an expression are handled
|
|
math $x + 1
|
|
set x 1
|
|
math $x + 1
|
|
set x 3
|
|
set y 1.5
|
|
math "-$x * $y"
|
|
math -s1 "-$x * $y"
|