help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Escaping in backquote string in double quoted strings --


From: KHMan
Subject: Re: [Help-bash] Escaping in backquote string in double quoted strings -- query about bash intent
Date: Tue, 7 May 2019 21:27:37 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 5/7/2019 9:07 PM, Greg Wooledge wrote:
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.

Already seen that in the ref man, that part in the ref man is quite similar. It doesn't say anything useful about \" behaviour in the nested scenario. The "`...`" there is just a single level `command` going by the style of the document.

So it's all undefined behaviour eh? Well, it sucks when users say the editor is buggy. So let me see if I can get a more substantial answer out of this list.


--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia




reply via email to

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