【发布时间】:2018-03-16 14:32:19
【问题描述】:
当我运行一个程序并且我想将该程序的输出发送到一个文件中时。 我尝试了什么
> tclsh hello.tcl > temp_out.txt
第一次将输出发送到 temp_out.txt 文件,但如果我再次运行,它会说 文件存在
> tclsh hello.tcl > temp_out.txt
> temp_out.txt : File exists
我希望当我运行这个程序时它应该删除文件的内容并再次将输出添加到 temp_out.txt 文件..
【问题讨论】:
-
你正在使用哪个外壳
-
echo $SHELL 给出“/bin/tcsh”
-
关闭
noclobber变量。 -
SO 是针对编程问题,而不是关于使用或配置 Linux 的问题。 SuperUser.com 或 unix.stackexchange.com 将是解决此类问题的更好地方。