# --nX switch (start) set num "10" set switch [lindex [split $args] 0] # switches set if {[regexp -- {--n[0-9]{0,}} $switch]} { set num [string range $switch 3 end] set rest [join [lrange [split $args] 1 end]] regsub -all -- {n} $num "" num } else {set rest [join [lrange [split $args] 0 end]]} # --nX switch (end) set rest [string map {"{" "" "}" ""} "$rest"]