23,125
社区成员
发帖
与我相关
我的任务
分享
几种方式对比:
1、echo "" > date
[@test]$ echo test > date
[@test]$ cat date
test
[@test]$ echo "" > date
[@test]$ od -c date
0000000 \n
0000001
可以看到,该方式在数据文件里还是有字符的
=======================
2、cat /dev/null > date
[@test]$ echo test > date
[@test]$ cat date
test
[@test]$ cat /dev/null > date
[@test]$ od -c date
0000000
可以看到,很干净
===========================
3、true > date
[@test]$ echo test > date
[@test]$ cat date
test
[@test]$ true > date
[@test]$ od -c date
0000000
[@test]$
同2,很干净!