Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11476

Re: \c-handling in $'-strings

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: \c-handling in $'-strings
Date 2015-09-03 09:58 -0400
Message-ID <mailman.448.1441288741.19560.bug-bash@gnu.org> (permalink)
References <op.x33p5xjhofd6j1@nebbiolo.upc.de> <mailman.248.1441030661.19560.bug-bash@gnu.org> <op.x4a2vqn6ofd6j1@nebbiolo.upc.de> <mailman.388.1441199993.19560.bug-bash@gnu.org> <op.x4cs37v5ofd6j1@nebbiolo.upc.de>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | NextPrevious in thread | Find similar


Thread

\c-handling in $'-strings "Helmut Karlowski" <helmut.karlowski@ish.de> - 2015-08-29 00:28 +0100
  Re: \c-handling in $'-strings Chet Ramey <chet.ramey@case.edu> - 2015-08-31 10:17 -0400
    Re: \c-handling in $'-strings "Helmut Karlowski" <helmut.karlowski@ish.de> - 2015-09-01 23:46 +0100
      Re: \c-handling in $'-strings Chet Ramey <chet.ramey@case.edu> - 2015-09-02 09:19 -0400
        Re: \c-handling in $'-strings "Helmut Karlowski" <helmut.karlowski@ish.de> - 2015-09-02 22:10 +0100
          Re: \c-handling in $'-strings Eric Blake <eblake@redhat.com> - 2015-09-02 15:44 -0600
          Re: \c-handling in $'-strings Chet Ramey <chet.ramey@case.edu> - 2015-09-03 09:58 -0400

csiph-web