comment sign (#) in switch body
Closed / Fixed218253ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:55:04
OriginalBugID: 2860 Bug
Version: 8.1
SubmitDate: '1999-09-21'
LastModified: '1999-09-28'
Severity: MED
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Solaris
OSVersion: 2.6.1
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '1999-09-28'
Name:
William Yan
Comments:
To keep comment systax consistent, require user put curly braces "{...}"
around the pattern or add backslash "\" right before hashmark "#" if
he/she do want to treat the hashmark "#" as a pattern.
ReproducibleScript:
#!/bin/sh
#Start Tclsh exec tclsh $0 $@
switch -regexp [lindex $argv 0] {
# branch1: get input string "a"
a {puts "input is a"}
b {puts "input is b"}
default {puts "input is neither a nor b"}
}
The above is the content of executable script file. Just run it in Unix
shell.
ObservedBehavior:
The interprete look the first line in switch body
# branch1: get input string "a"
as a real branch although as my intent it was comment. And the
interprete then reports error.
DesiredBehavior:
Add comments in switch body.
This sort of comment placement is user error, as specifically
stated in the switch man page. The man page has been further
updated for 8.3b1 to include an example of proper comment
placement.
-- 09/28/1999 hobbs
welch Closed ticket [218253ffff].
[History diff]2000-10-26 08:17:55
dgp Ticket [218253ffff]: 3 changes
[History diff]2001-04-18 06:36:24
Log in (anonymous is fine) to add a comment.