[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash: echoing octal, disagreement between man page and behaviour
From: |
Giles Orr |
Subject: |
Re: bash: echoing octal, disagreement between man page and behaviour |
Date: |
Sun, 26 Jul 2009 15:57:36 -0400 |
Hi Chet, Bob.
I see what the problem is, and yes, it appears to be documentation
rather than a "bug." My apologies. However, in the copy I have of
the man page (I run Debian testing, whatever is default with that and
possibly not up-to-date with the latest version of Bash ... The octal
thing is mentioned in at least two places and they don't agree. Under
the section for "echo" it says "\0nnn", but under the section
"QUOTING" it discusses backslash escape sequences and gives octal as
"\nnn". Since I just searched for "octal" on the man page, I hit the
"QUOTING" section first.
Thanks for the update, hope this clarifies.
2009/7/26 Chet Ramey <chet.ramey@case.edu>:
> Giles Orr wrote:
>> Hello.
>>
>> Not sure if this a bug or a documentation problem: it's certainly a
>> change from previous behaviour, and a disagreement between current
>> behaviour and the documentation.
>>
>> The man page says that:
>>
>> $ echo -e "\173"
>>
>> should produce a "{" but instead it produces a "\173". Since
>>
>> $ echo -e "\073"
>>
>> acts as behaved, producing a ";", I wondered if perhaps this would work:
>>
>> $ echo -e "\0173"
>>
>> and it does, giving the expected opening brace.
>
> I'm not sure which man page you're looking at, but the one shipped with
> bash-3.2.48 includes the following in the description of "echo":
>
> \0nnn the eight-bit character whose value is the octal value
> nnn (zero to three octal digits)
>
> I think that makes it pretty clear that the leading 0 is not optional.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>
> Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
>
--
Giles
http://www.gilesorr.com/
gilesorr@gmail.com