[root@stu227 he]# touch he.txt
[root@stu227 he]# set -o noclobber
[root@stu227 he]# echo "123" > he.txt
bash: he.txt: cannot overwrite existing file
如果要取消限制,就把set -o 改为set +o
[root@stu227 he]# set +o noclobber
[root@stu227 he]# echo "123" > he.txt
[root@stu227 he]# cat he.txt
123
linux下避免文件覆盖的命令
原文:http://10596480.blog.51cto.com/10586480/1681369