|
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:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.0 |
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 validMy 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'tDitto, 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. :-)
-- MatthewVs lbh pna ernq guvf jvgubhg fbsgjner, lbh ner n FREVBHF areq! -- Nqncgrq sebz Znggurj Jva (ivz-qri znvyvat yvfg)
[Prev in Thread] | Current Thread | [Next in Thread] |