开发者

Can't call tcl commands in procedures that I can in console

开发者 https://www.devze.com 2023-01-02 23:28 出处:网络
I installed cygwin/curl on my machine and from tcl console or tclsh I can call the curl command however if I try to do it in a procedure I get the \"invalid command name (name)\" error.

I installed cygwin/curl on my machine and from tcl console or tclsh I can call the curl command however if I try to do it in a procedure I get the "invalid command name (name)" error.

e.g.

%curl -o google.html http://www.google.com

works, but

%proc a {} {curl -o google.html http://www.google.com}
%a

gives

invalid command name "curl"

I thought this was a namespace issue or something trivial but su开发者_开发技巧rprisingly I couldn't find too much useful information on it.


In an interactive session, Tcl will try to "exec" anything you type that it doesn't understand. In a script it won't. Check out the "exec" and "catch" commands.

0

精彩评论

暂无评论...
验证码 换一张
取 消