On Thu, Dec 14, 2023 at 09:41:17AM +0530, Sundeep Agarwal wrote: > Thanks for the correction on my second example. I had assumed ^ wasn't > special inside double quotes since the documentation mentions only the ! > character for history expansion ( > https://www.gnu.org/software/bash/manual/bash.html#Double-Quotes). > > However, no character should be treated specially inside single quotes, > right? > > $ echo 'fig > ^mango' > fig > !!:s^mango
This one also depends on history expansion being active. unicorn:~$ bash-5.2 unicorn:~$ set -H unicorn:~$ echo 'fig > ^mango' fig !!:s^mango unicorn:~$ set +H unicorn:~$ echo 'fig > ^mango' fig ^mango Is that the correct behavior? I have no idea. I don't understand the rationale behind this piece of histexpand *at all*, so I don't know whether it's supposed to trigger inside single quotes. Or even what it's *doing*. I turned off histexpand decades ago, and haven't missed it. But that's just me.