有人可以解释为什么这一直失败吗?
set hostname ""
if {$hostname eq ""} {
puts "Usage: host [-u username] [-p password] [-f]"
exit 5
}
if {[string length $hostname] == 0} {
puts "Usage: host [-u username] [-p password] [-f]"
exit 5
}
if {[string equal $hostname ""]} {
puts "Usage: host [-u username] [-p password] [-f]"
exit 5
}
我收到以下错误:
invalid command name "-u"
while executing
"-u username"
invoked from within
"if {$s eq ""} {puts "Usage: host [-u username] [-p password] [-f]"}"
代码似乎执行得很好,但我似乎无法将 puts 与包含大括号的字符串一起使用。