我有一个带有这个片段的脚本:
while {[gets $fin line] != -1} {
if {[string first "Modem :" $line] != -1} {
set line2 [string range $line 17 end]
puts $fout "One : \t$line2"
}
puts $fout "Two : \t$line2"
}
工作并打印输出(当One :
我不包含Two :
脚本中的部分时)但是当我包含时Two :
,它显示
error : can't read "line2": no such variable
while executing
"puts $fout "Two : \t$line2""
("while" body line 14)
line2
出来后不保值if
吗?