当我运行程序并且我想在文件中发送此程序的输出时。 我尝试了什么
> tclsh hello.tcl > temp_out.txt
第一次将输出发送到temp_out.txt文件,但是如果我再次运行则说明 文件存在
> tclsh hello.tcl > temp_out.txt
> temp_out.txt : File exists
我希望在运行此程序时,它应删除文件内容并再次将输出添加到temp_out.txt文件中。
答案 0 :(得分:1)
尝试像这样运行,
tclsh hello.tcl >! temp_out.txt
它将覆盖现有的[temp_out.txt]文件。