bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About `M-C-e` expand result `'` failed


From: Zachary Santer
Subject: Re: About `M-C-e` expand result `'` failed
Date: Tue, 6 Feb 2024 18:54:48 -0500

On Tue, Feb 6, 2024 at 3:13 PM Chet Ramey <chet.ramey@case.edu> wrote:

> There are other places (e.g., ${var@Q} where bash chooses the most
> appropriate form of quoting. Why not here?


zsant@Zack2021HPPavilion MINGW64 ~
$ animal='dog'

zsant@Zack2021HPPavilion MINGW64 ~
$ action='chases the cat'

zsant@Zack2021HPPavilion MINGW64 ~
$ printf '%s\n' "${animal}" "${action}"
dog
chases the cat

zsant@Zack2021HPPavilion MINGW64 ~
$ printf %s\n dog chases the cat # Same command as above, but with M-C-e
dognchasesnthencatn
zsant@Zack2021HPPavilion MINGW64 ~
$ printf '%s\n' "${animal@Q}" "${action@Q}"
'dog'
'chases the cat'

When Bash is looking at a line like
$ printf %s\n dog chases the cat
where should it choose to add quotes?

Compare this scenario to a hypothetical readline command that transforms
the command line so as to show the results of expansions, but leaving
quoting in place and adding backslashes, such that the end result of
evaluating the transformed line is identical to what would've happened had
the line not been transformed.

I accept the argument that you can just undo the M-C-e operation, though.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]