[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \c-handling in $'-strings
From: |
Helmut Karlowski |
Subject: |
Re: \c-handling in $'-strings |
Date: |
Wed, 02 Sep 2015 22:10:45 +0100 |
User-agent: |
Opera Mail/12.16 (Win32) |
Am 02.09.2015, 14:19 Uhr,SCHRIEB Chet Ramey <chet.ramey@case.edu>:
echo $'\c?' |od -a
echo $'\c[\c\\c]\c^\c_\c?' |od -a
bash prints:
0000000 us nl
0000002
0000000 esc fs c ] rs us us nl
I'd expect:
0000000 del nl
0000002
0000000 esc fs gs rs us del nl
Also the ] in the output seems wrong, looks it gets the \\ wrong, though
ksh93 does this also.
The Posix standardization of $'...' requires that the character after the
Where is that described? I could not find anything about $'...' in the
posix-docs.
`\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.
-Helmut