help-bash
[Top][All Lists]
Advanced

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

Re: Why no closing single quote is needed when a single quote is escaped


From: Lawrence Velázquez
Subject: Re: Why no closing single quote is needed when a single quote is escaped?
Date: Thu, 31 Dec 2020 19:04:07 -0500

> On Dec 31, 2020, at 6:48 PM, Chris F.A. Johnson <chris@cfajohnson.com> wrote:
> 
> On Thu, 31 Dec 2020, Peng Yu wrote:
> 
>>>> x='\'
>>> The difference between single quoting and double quoting is fully
>>> explained in the bash manual page, under the section "QUOTING".
>> 
>> The man page says the following. But it doesn't say why a closing
>> single quote is not need to pair with the first quote. Why \' makes
>> the closing single quote unnecessary.
> 
> The closing single quote IS necessary. That's what the second single quote is.
> 
> When inside single quotes, the backslash is not special; it is just a
> literal backslash ... which is what the following sentence that you
> quoted says:

Put another way,

        x='\'

is not equivalent to

        x=\'

but rather to

        x=\\

vq


reply via email to

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