he.txtbash: he.txt: cannot overwrite existing file如 内蒙古资源网更新日期:2024/10/4" />
操作系统 
首页 > 操作系统 > 浏览文章

CentOS下如何避免文件覆盖?

(编辑:jimmy 日期: 2024/10/4 浏览:3 次 )

[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

上一篇:RHEL配置Centos yum源的方法
下一篇:CentOS常用的文本查看命令详解