On Tue, 8 Aug 2023, 23:24 Zachary Santer, <zsan...@gmail.com> wrote:

> Description:
> Similarly, history expansion occurs within arithmetic substitutions. This
> will never, ever be what the user wants.


Correction: it will never ever be what YOU want.
I can certainly think of uses for history expansion in arithmetic context,
for example (imagine this done with much bigger numbers):

$ coprimepairs 7 9 32 48
7 9
7 32
9 32
$ echo $(( !:2 * !:3 ))
echo $(( 9 * 32 ))
288
$

If anyone wants to avoid such history expansion, that's easy: always put
spaces around operators in arithmetic context.

I would recommend turning on histreedit, so that it's less cumbersome to
fix any unexpected history expansions.

$ echo $(( ! 0 ))
1
$

Please don't go breaking existing functionality just because someone can't
imagine a use for it.

-Martin

Reply via email to