Overview
| Artifact ID: | b1afffd69ab55bf90fb987409817d787d16558c2 |
|---|---|
| Ticket: | 1537233fffffffffffffffffffffffffffffffff
Switch doesn't variable substitution |
| User & Date: | ctasada on 2006-08-09 08:57:41 |
Changes
- assignee changed to: "dkf"
- cmimetype changed to: "text/plain"
- comment changed to:
Hi again guys, I've seen a feature request that can be related (1106138) so probably it's a known "feature" of the switch command. Anyway I find it quite strange. Here is the script that shows the actual problem: # Create some variables and assign numbers to them set one 1 set two 2 set three 3 set value 2 switch -- $value { $one {puts 1} $two {puts 2} $three {puts 3} default {puts "$value is unknown"} } % 2 is unknown switch -- $value { 1 {puts 1} 2 {puts 2} 3 {puts 3} default {puts "$value is unknown"} } % 2 As you can see looks like is not doing the variable substitution. Googling a bit I found this solution: switch -- $value [list\ $one {puts 1}\ $two {puts 2}\ $three {puts 3}\ default {puts "$value is unknown"}\ ] % 2 Which works, but is quite dirty. Should be considered a bug? - foundin changed to: "obsolete: 8.5a4"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "ctasada"
- subsystem changed to: "18. Commands M-Z"
- title changed to: "Switch doesn't variable substitution"
- type changed to: "Bug"