bug-bash
[Top][All Lists]
Advanced

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

Re: $\n doesn't get expanded between double-quotes


From: Chet Ramey
Subject: Re: $\n doesn't get expanded between double-quotes
Date: Fri, 03 Jul 2009 13:11:03 -0400
User-agent: Thunderbird 2.0.0.22 (Macintosh/20090605)

Chris F.A. Johnson wrote:
> On Fri, 3 Jul 2009, fsc-log-rjn@richardneill.org wrote:

>> Fix:
>>      $'\n'  should be expanded within double-quotes, like other variables 
>> are. 
>>      Otherwise, please correct the man-page to make it clearer.
> 
>    $'\n' is not a variable. As the man page says:
> 
>             Words of the form $'string' are treated specially.
> 
>    Note "Words". Inside double quotes, $'\n' is not a word.

Richard is correct that the manual page does not quite represent the
current behavior accurately.  I think that replacing "Words" with
"Unquoted strings" or "Unquoted substrings" or even "Single-quoted
strings preceded by an unquoted '$' are treated specially." might
be better.

For instance, you can use

X=a$'\n'b ; echo "$X"
or
echo a$'\n'b

to obtain the results Richard wants, and the ansi-c quoted portions of
the strings are not words.

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/




reply via email to

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