TCL中“>stdout”和“>@stdout”的用法区别

Difference in usage for "> stdout" and ">@ stdout" in TCL

我有各种使用 >@ stdout> stdout 来执行命令的命令:eval exec $commandName 2>@ stderr >@ stdout <@ stdin。其中一些使用 >@,而另一些则在 stdout 或 stderr 命令前简单地使用 >。我正在尝试制作一种通用的执行方法,我注意到如果我添加 @ ,它会将所有内容打印到屏幕上,而没有 @ 它不会,这正是我喜欢的。

我在此处阅读了 eval exec 的文档:https://www.tcl.tk/man/tcl/TclCmd/exec.htm#M20 and I see that the @ allows to provide a fileId, however if I'm using the default stdout and stderr, it should make no difference if I used the @ since it defaults to std according to this link: http://zetcode.com/lang/tcl/io/

我想确保我不会 运行 遇到任何意外错误。

> stdout

将输出重定向到名为 'stdout' 的文件,而不是标准输出文件描述符。

>@ stdout

将输出重定向到 fileId stdout,并将打印到当前 stdout, 通常是屏幕。