[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: |
Chris F.A. Johnson |
Subject: |
Re: Why no closing single quote is needed when a single quote is escaped? |
Date: |
Wed, 30 Dec 2020 23:58:01 -0500 (EST) |
User-agent: |
Alpine 2.22 (DEB 394 2020-01-19) |
On Wed, 30 Dec 2020, Peng Yu wrote:
Hi,
x='\'
The above command works. But the following command doesn't. It doesn't
make sense to me why the above command should work without closing the
initial single quote. Could anybody help explain why this syntax
should be correct? Thanks.
x="\"
A single quote cannot be escaped; a double quote can be.
--
Chris F.A. Johnson <http://cfajohnson.com/>
=========================== Author: ===============================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)