Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-20
02:53 • Closed ticket [219411ffff]: writing scripts from scripts - backslash substitutio... artifact: d75af6c39f user: dgp
02:52 • Open ticket [219411ffff]. artifact: ff4849cb14 user: dgp
2000-11-06
23:28 • Closed ticket [219411ffff]. artifact: f8c8e54178 user: dkf
2000-10-26
05:12 • New ticket [219411ffff]. artifact: d79e17406d user: nobody

writing scripts from scripts - backslash substitution in {..

Closed / Wont Fix219411ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 05:12:35
OriginalBugID: 6357 Bug
Version: 8.4a1
SubmitDate: '2000-10-16'
LastModified: '2000-10-25'
Severity: MED
Status: UnAssn
Submitter: techsupp
OS: Linux
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
John Ellson

CVS:
Oct 12, 2000.  3am  (patchlevel 8.4a2)

ReproducibleScript:
#!/usr/local/bin/tclsh8.4

### this backslash gets lost
set script {#!/bin/sh
# the next line is a comment in tcl, but executable by sh  exec wish "$0" ${1+"$@"}
puts "hello world"
}
puts $script

### these backslashes remain doubled
set script {#!/bin/sh
# the next line is a comment in tcl, but executable by sh \\
exec wish "$0" ${1+"$@"}
puts "hello world"
}
puts $script

ObservedBehavior:
I'm trying to write a script from a tcl script, including the
magic initial construct:
#!/bin/sh
# the next line is a comment in tcl, but executable by sh  exec wish "$0" ${1+"$@"}

tcl is substituting the trailing backslash even though the string is in braces.

DesiredBehavior:
no backslash substitutions in braced strings.
dkfplain2000-11-06 23:28:41
Tcl is defined to behave this way, and I'd be extremely hesitant to change it since it would probably adversely affect many other scripts.  You'll just have to express the string constant in a different way...  :^(
dgp Open ticket [219411ffff]. [History diff]2001-04-20 02:52:14
dgp Closed ticket [219411ffff]. [History diff]2001-04-20 02:53:39
Log in (anonymous is fine) to add a comment.