On Tue, Feb 6, 2024 at 3:13 PM Chet Ramey <chet.ra...@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.