[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Escaping in backquote string in double quoted strings --
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Escaping in backquote string in double quoted strings -- query about bash intent |
Date: |
Tue, 7 May 2019 09:07:25 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, May 07, 2019 at 08:52:02PM +0800, KHMan wrote:
> If this is inappropriate for help-bash, I can repost it on the dev list. But
> here I am only trying to understand the _intention_ of the code so that I
> can code the appropriate highlighting fix -- it's really still a glorified
> shell user's query.
You might be better off looking at the POSIX spec that bash is trying to
implement, rather than the implementation.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03
Within the backquoted style of command substitution, <backslash> shall retain
its literal meaning, except when followed by: '$', '`', or <backslash>. The
search for the matching backquote shall be satisfied by the first unquoted
non-escaped backquote; during this search, if a non-escaped backquote is
encountered within a shell comment, a here-document, an embedded command
substitution of the $(command) form, or a quoted string, undefined results
occur. A single-quoted or double-quoted string that begins, but does not end,
within the "`...`" sequence produces undefined results.
With the $(command) form, all characters following the open parenthesis to
the matching closing parenthesis constitute the command. Any valid shell
script can be used for command, except a script consisting solely of
redirections which produces unspecified results.
Good luck trying to decipher that.