Re: Correction in documentation

Greg Wooledge <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
On Fri, Jan 02, 2026 at 16:34:59 +0530, Anshuman Khanna wrote:
> On this
> <https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html>
> page

(which describes the $'...' quoting form)

> of Bash documentation, it is mentioned that to type an ASCII character we
> can write it in its octal notation. However, there is a mistake here.
> 
> The documentation says that the character must be written as `\nnn` where
> "nnn" are octal digits. The actual working requires that we type as `\0nnn`
> where "nnn" are octal digits. Without the `\0` "nnn" isn't recognised as an
> octal representation.

Your claim is incorrect.

hobbit:~$ printf %s $'\1abc' | hd
00000000  01 61 62 63                                       |.abc|
00000004
hobbit:~$ printf %s $'\10abc' | hd
00000000  08 61 62 63                                       |.abc|
00000004

\1 and \10 are both recognized as octal values.  This works in bash 5.2,
5.3 and 2.05b, and though I didn't test any other versions just now,
I'm pretty confident it didn't change in between.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.