[Top][All Lists]

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

Re: What does extquote do

From: Chet Ramey
Subject: Re: What does extquote do
Date: Sun, 16 Oct 2005 17:18:31 -0400
User-agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)

Enrique Perez-Terron wrote:
> I am unable to make sense of the bash man-page description of the
> extquote shopt option.
> It says:
>   extquote
>    If set, $’string’ and $"string" quoting is performed within
>    ${parameter} expansions enclosed in double quotes.  This option
>    is enabled by default.
> Can anybody come up with an example where the setting of extquote
> makes a difference?   I would actually like to have two examples,
> one with $'string' and one with $"string".

Sure.  Run the following:

shopt -u extquote

echo "${v:-$"translate me"}"
echo "${v:-$'ab\ncd'}"

shopt -s extquote

echo "${v:-$"translate me"}"
echo "${v:-$'ab\ncd'}"

``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live Strong.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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