bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: \c-handling in $'-strings


From: Chet Ramey
Subject: Re: \c-handling in $'-strings
Date: Thu, 3 Sep 2015 09:58:42 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 9/2/15 5:10 PM, Helmut Karlowski wrote:

>> `\c' honor backslash escaping.  Since the character becomes \c\\, the
>> subsequent `c' and `]' are literals.
> 
> I assume this is only true for "to-be-escaped" characters, that is
> 
> $   `   "   \   <newline>
> 
> like for ".."-strings? Of course only \ is of interest here.
> 
> If that is true then the output of ksh93 for
> 
> echo $'\c\d' |od -a -> 0000000 eot  nl
> 
> is wrong? It removes the \ every time.

The proposal leaves it implementation-defined.  It specifically mentions
that you have to use \c\\ to represent <FS> to avoid ambiguity in the
backslash processing.  Bash chooses to preserve the backslash before any
unrecognized escape sequence.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]