# --n# set switch [lindex [split $args] 0] # if switch is not --n then return if {![regexp -- {--n[0-9]{1,}} $switch]} {return "--n10"} # take the number after --n set num [string range $switch 3 end] set rest [join [lrange [split $args] 1 end]] regsub -all -- {n} $num "" num