On Wed, Mar 17, 2021 at 01:55:56PM -0400, Eli Schwartz wrote: > On 3/17/21 12:43 PM, Alex fxmbsw7 Ratchev wrote: > > it makes the output no more possible if interpreted by tty > > the \e's get processed by terminal and no more .. just an example where it > > is so: > > > > var=$'1\e[G\e[K2' ; declare -p var > > > > if G was H for other line then it completly messes the terminal up > > > > isnt it better to escape by \e ? .. > > Why is it the bash script interpreter's job to escape user-supplied > strings based on how a terminal emulator chooses to *visually* display > the results?
Call it a request for enhancement. I thought, for a moment, that bash already used $'...' quoting for newlines, but it turns out that's false. At least for declare -p. It would be nice if it did, though. Newlines, carriage returns, escape characters, etc.