[Top][All Lists]

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

Re: how does bash parse back-ticks, anyway? (was: [Bug 103756] kate: syn

From: Matthew Woehlke
Subject: Re: how does bash parse back-ticks, anyway? (was: [Bug 103756] kate: syntax highlighting error: bash and escaped quotes)
Date: Mon, 02 Apr 2007 18:09:16 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070221 Thunderbird/ Mnenhy/

Since this is not really appropriate to the bug report, I am moving it exclusively to the lists. Please direct replies to kwrite-devel<at>kde.org and bug-bash<at>gnu.org.

Carsten Lohrke wrote:
Matthew Woehlke wrote:
Carsten Lohrke wrote:
Current bash.xml accepts (a), but not (b). The single qoute is
the start of string highlight. It's also not just the backtick
block, but the backtick block inside of a double quote string
block - and vice versa.

x="`echo \"'\\\"\"`"    is valid

My bash highlighter thinks this is invalid. So does my brain. However bash 
seems OK with it. Why, I wonder? Maybe I am not clear on the expansion rules in 
this instance.

x=`echo \"'\\\"\"`      isn't

Ditto, except bash also (correctly IMO) doesn't like it.

The other way around:

x=`echo "'\""`          is valid

x="`echo "'\""`"        isn't

but both are highlighted as valid.

That's odd, because all of the following are valid:

echo "'\""
echo `echo "'\""`
x="$(echo "'\"")" <-- this should be syntactically equivalent?!

...so this feels like a bug in bash.

Matthew, it's not a bug in bash, it's a feature. $(foo) and `foo`
are not 100% equivalent. Read the command substitution paragraph
in the bash man page.

I did, and I saw that it talked about them being different, but I didn't understand *how* they were supposed to be different (besides, you've got some weirdnesses in there that look like they should/shouldn't work regardless of the back-ticks). In particular I fail to understand why whether or not there are quotes around the back-ticks should have any effect (which it clearly does). So until someone on bug-bash explains to me differently, I'm not convinced bash.xml is wrong.

If nothing else, I'll stand by it being a bash bug, if only in the docs because they are not sufficiently clear. :-)

Vs lbh pna ernq guvf jvgubhg fbsgjner, lbh ner n FREVBHF areq! -- Nqncgrq sebz Znggurj Jva (ivz-qri znvyvat yvfg)

reply via email to

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