Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Alexandre Ferrieux <alexandre.ferrieux@xxxxxxxxx>
- Date: Mon, 10 Mar 2008 09:47:29 -0700 (PDT)
On Mar 10, 5:22 pm, heiner.mar...@xxxxxxxx (Heiner Marxen) wrote:
In article <f9e3cb96-f42c-43a1-8b8e-27debbec6...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx> writes:> On Mar 8, 11:58 pm, Witek Mozga <mo...@xxxxxxxxxxxxxxxxx> wrote:
Can you post a few lines around line 17042 ?
cat >confdef2opt.sed <<\_ACEOF
note this quoting---------^
t clearStrangely I cannot reproduce the problem, though I tried the bash/ksh
: clear
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
t quote
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
t quote
d
: quote
# Below is 17042nd line
s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
s,\[,\\&,g
s,\],\\&,g
s,\$,$$,g
p
_ACEOF
pair on several Linuxes and a Solaris...
I'm not sure, but in the above several things seem to be wrong:
Shouldn't the block given to "<<" be dollar- and backquote-substituted
by the shell ?
Since (part of) the delimiter word (_ACEOF) is quoted, all expansion
inside the here document should be suppressed.
But the error message looks like the backtick is interpreted as
the start of an embedded command :
syntax error near unexpected token `{}\\'
./configure: line 17042: `s,[ `~#$^&*(){}\\|;'"<>?],\\&,g'
The unexpected token end before a pipe character, supporting this view.
Why bash tries to expand backticks at this place, although is shouldn't
(and ksh doesn't), I have no idea, short of suspecting a bash bug.
What exact version of bash do you use? (bash --version)
I'm using 3.00.0(1) without your problem (backtick is taken literally).
I continued to experiment a bit with my bash 3.00.0(1)...
When I delete the backslash before _ACEOF I get this error:
yy1: command substitution: line 1: syntax error near unexpected token `{}\|'
yy1: command substitution: line 1: `~#$^&*(){}\|;'"<>?],\&,g'
which looks different from your error message.
BUT... when I prepend a command and open a backtick like this
: `
before all your code, I get:
yy1: line 11: syntax error near unexpected token `{}\\'
yy1: line 11: `s,[ `~#$^&*(){}\\|;'"<>?],\\&,g'
which matches your error text much better.
Hence I suspect, that bash parses the above code as part of an already
opened backtick enclosed token... for reasons unknown to me.
The cause has to be before the code we saw so far.
Hope this helps somewhat.
--
Heiner Marxen http://www.drb.insel.de/~heiner/
Thanks a huge lot Heiner ! The backslash after << did hit my
peripheral nervous system, but I dismissed it under the load of other
metacharacters ;-)
To the OP: a possible fix (among others) is to program defensively
against bash bugs, by avoiding to use the backslash after <<.
Doing this, of course, implies to escape all backquotes, dollars,
*and* backslashes in the << bodies. No free lunch :-)
Personally, to do the same (build temporary sed scripts with highly
active chemicals inside *and* things to be substituted), I prefer to
use the shell's virtuosity with alternating single quotes and naked or
double-quoted variables:
sedscript='s/CHEMICALS/'"$var"'/g'
this gives better control over the substituted vs. protected parts
than the << operator. The cost being the '\'' everywhere you need a
literal single quote between single quotes. Who talked about free
lunches ?
-Alex
.
- References:
- why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Witek
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Bezoar
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Alexandre Ferrieux
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Witek Mozga
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Alexandre Ferrieux
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Witek Mozga
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Alexandre Ferrieux
- Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- From: Heiner Marxen
- why tcl/tk doesn`t incorporate tclx, tile, etc.
- Prev by Date: Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- Next by Date: Re: casual tcl programming on Macs
- Previous by thread: Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- Next by thread: Re: why tcl/tk doesn`t incorporate tclx, tile, etc.
- Index(es):
Relevant Pages
|