[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected Quick Substitution in string literals
From: |
Sundeep Agarwal |
Subject: |
Re: Unexpected Quick Substitution in string literals |
Date: |
Thu, 14 Dec 2023 09:41:17 +0530 |
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
On Wed, Dec 13, 2023 at 5:54 PM Greg Wooledge <greg@wooledge.org> wrote:
> On Wed, Dec 13, 2023 at 10:50:16AM +0530, Sundeep Agarwal wrote:
> > $ echo "fig
> > ^mango"
> > bash: :s^mango": substitution failed
>
> I can confirm this happens in every version of bash, at least back to
> bash-2.05b which is as far as I can go, but only when history expansion
> is enabled (set -H or set -o histexpand).
>
> I think this is intended behavior, although I'm someone who routinely
> disables histexpand, so I'm not as familiar with all of its features as
> others might be.
>