Date: Mon, 26 Oct 2020 03:49:16 +0000 From: David Holland <dholland-t...@netbsd.org> Message-ID: <20201026034916.ga29...@netbsd.org>
| Also if inserting newlines is an intended use case, I kinda think it | ought to accept \n in there, which it currently doesn't. That would be "C string quoting" which is $'\n' which isn't yet in POSIX but should be coming sometime, it is supported by most (Bournish) shells these days, but there are differences in some of the more esoteric features (like exactly what should happen with a \uxxxx (or \Uxxxxxxxx) which insert a unicode code point, when the current locale is not a utf-8 locale. Some shells, including ours, simply insert the UTF-8 for that code point, others attempt to convert to the current locale encoding of the same character). We cannot convert \n in "" quoting, as \ in "" is defined to mean something (to "be special") only when the following character is \ $ ` " or an actual newline. All other sequences \x are simply two characters, \ and x (which is also what \\x produces). This is the way the original Bourne sh did it, and is absolutely set in stone (surrounded by reinforced concrete, wrapped in a layer of solid diamond) now. On the other hand, for $'' quoting (C style strings) \ followed by something for which there is no specified meaning is reserved (unspecified results) so in that one there is room for future expansion. kre