Http 具有curl代码400的tcl

Http 具有curl代码400的tcl,http,curl,tcl,Http,Curl,Tcl,我在使用tcl循环curl linux命令时遇到问题: for {set i 0} {$i<20} {incr i} { if {[catch {set x [exec curl -x 192.168.254.1:8081 -w "%{http_code}" "http://www.playboy.com"]} y]} { puts "$y" } else { puts "$x" } } for{set i 0}{$i此代

我在使用tcl循环curl linux命令时遇到问题:

for {set i 0} {$i<20} {incr i} {
   if {[catch {set x [exec curl -x 192.168.254.1:8081 -w "%{http_code}" "http://www.playboy.com"]} y]} {
            puts "$y"
   } else {
            puts "$x"
   }
}

for{set i 0}{$i此代码看起来有误。您在第一次尝试后始终调用return,因此不需要for。
y
即使没有错误也会被设置,因此您的代码等于
catch{exec curl-x 192.168.254.1:8081-w“{http_code}”http://www.playboy.com“}y;返回$y
抱歉,我已经更正了它。