Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我经常需要清除目录中所有文件的内容(即 Apache Tomcat 日志)。我以这种方式使用 UNIX 的重定向运算符:
> catalina.out
如何将其应用于当前目录中的所有文件(以清除所有日志)?
我试过> *.*了,但没有意义。感谢帮助。
> *.*
一个小循环可以做到:
for file in * .* <---- * for normal files // .* for hidden files do echo "clearing $file" > $file done