Zachary Santer <zsan...@gmail.com> writes: > Description: > Similarly, history expansion occurs within arithmetic substitutions. This > will never, ever be what the user wants. And now I know how to make it not > happen. > > Repeat-By:
> $ set +o histexpand Well, yes, if you turn off history expansion, then it won't occur within arithmetic substitutions. But I would not take it as given that nobody would ever want to use history expanstion within an arithmetic substitution. Let me concoct an example: $ i=4 $ echo (( i+1 )) bash: syntax error near unexpected token `(' $ echo $(( !:3 )) echo $(( i+1 )) 5 $ (This would be more likely if "i+1" was a much more complicated expression.) But it seems to me that the way to avoid this is to always put a space after "!" in arithmetic expressions. "!" followed by space is never subject to history expansion. More troublesome, I think, are several variable substitutions which include "!" followed by a name. But I doubt they're used much in interactive mode. Dale