Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: \c-handling in $'-strings Date: Thu, 3 Sep 2015 09:58:42 -0400 Lines: 27 Approved: bug-bash@gnu.org Message-ID: References: Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1441288742 15993 208.118.235.17 (3 Sep 2015 13:59:02 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: Helmut Karlowski , bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: X-Junkmail-Status: score=10/60, host=mpv5.cwru.edu X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.105.36 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11476 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 > > $ ` " \ > > 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 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/