【发布时间】:2011-11-28 21:16:56
【问题描述】:
假设有一个文件 log.txt 并且某种日志被永久附加到它上面。
我想在 TCL 环境中跟踪那个文件。
我试过了,但是没用。
set log [open log.txt a]
for { } { true } { update; after 1000 } {
# expected to get here the appended part
read $log
seek $log 0 end
}
是否可以通过相同的文件句柄log读取修改后的文件,或者我必须关闭并重新打开文件log.txt?
在 TCL 中有没有一种相当于 Linux 命令tail -f 的东西?
【问题讨论】:
-
这可能会有所帮助 -
http://code.activestate.com/recipes/65437-tail-a-file/