在linux终端中它说文件存在

时间:2017-10-05 04:09:36

标签: linux file terminal tcsh

当我运行程序并且我想在文件中发送此程序的输出时。 我尝试了什么

> tclsh hello.tcl > temp_out.txt

第一次将输出发送到temp_out.txt文件,但是如果我再次运行则说明 文件存在

> tclsh hello.tcl > temp_out.txt
> temp_out.txt : File exists

我希望在运行此程序时,它应删除文件内容并再次将输出添加到temp_out.txt文件中。

1 个答案:

答案 0 :(得分:1)

尝试像这样运行,

tclsh hello.tcl >! temp_out.txt

它将覆盖现有的[temp_out.txt]文件。