echo -n "" > /server/tomcat/logs/catalina.out ==>要加上"-n"参数,默认情况下会"\n",也就是回车符
du -h /server/tomcat/logs/catalina.out
使用echo命令清空tomcat日志文件测试实例:
[root@zdz ~]# echo -n "" > /server/tomcat/logs/catalina.out
[root@zdz ~]# du -h /server/tomcat/logs/catalina.out
0 /server/tomcat/logs/catalina.out