由于第11行:意外标记“}'”附近的语法错误,无法执行tcl脚本;
附件是我的密码。但是,当我执行它时,会出现以下错误消息:第11行:意外标记“}”附近的语法错误 因为我是tcl的新手,我不知道哪里出了问题。请帮忙!!!非常感谢由于第11行:意外标记“}'”附近的语法错误,无法执行tcl脚本;,tcl,Tcl,附件是我的密码。但是,当我执行它时,会出现以下错误消息:第11行:意外标记“}”附近的语法错误 因为我是tcl的新手,我不知道哪里出了问题。请帮忙!!!非常感谢 set filename "a.qip" set temp [create_temp_file a.qip] set out [open $temp w] set in [open $filename r] set entityname "edward" while {[gets $in line] != -1} {
set filename "a.qip"
set temp [create_temp_file a.qip]
set out [open $temp w]
set in [open $filename r]
set entityname "edward"
while {[gets $in line] != -1} {
if {[string match "*SDC_FILE*" $line]} {
puts $out $line
puts $out "set variant_name $entityname"
} else {
puts $out $line
}
}
close $in
close $out
file link -hard $filename a.qip.bak
file rename -force $temp $filename
您正试图使用
sh
来解释Tcl文件:
$ sh f.tcl
f.tcl: line 11: syntax error near unexpected token `}'
f.tcl: line 11: ` } else {'
您需要使用tclsh
$ tclsh f.tcl
invalid command name "create_temp_file"
while executing
"create_temp_file a.qip"
invoked from within
"set temp [create_temp_file a.qip]"
(file "f.tcl" line 2)
您正试图使用
sh
来解释Tcl文件:
$ sh f.tcl
f.tcl: line 11: syntax error near unexpected token `}'
f.tcl: line 11: ` } else {'
您需要使用tclsh
$ tclsh f.tcl
invalid command name "create_temp_file"
while executing
"create_temp_file a.qip"
invoked from within
"set temp [create_temp_file a.qip]"
(file "f.tcl" line 2)
如果文件a.qip包含特定的字符状卷曲“{”和“}”,它将被字符串匹配错误解释。如果文件a.qip包含特定的字符状卷曲“{”和“}”,它将被字符串匹配错误解释。不正确:
设置行”和{大括号}{SDC_文件…”;如果{[string match”*SDC_文件*“$line]}{puts OK}
是的,你是对的。我有一个类似的问题,但它与lindex的使用有关。除非你明确要求,否则Tcl不会计算变量的内容。你是否使用了eval
或uplevel
?不正确:设置行”和{大括号}{SDC_文件…”;如果{[string match”*SDC_文件*“$line]}{puts OK}
是的,你是对的。我有一个类似的问题,但它与lindex的使用有关。Tcl不会评估变量的内容,除非你明确要求它。你是在使用eval
还是uplevel
?很抱歉发表了一个愚蠢的评论,但很好,很享受!很抱歉发表了一个愚蠢的评论,但很好,很享受信息技术