CentOS下如何避免文件覆盖?

https://www.518cn.com   发布时间:2025-03-18 09:06   作者:网络
摘要:下面小编为大家带来的是CentOS下下避免文件覆盖的命令;希望可以对大家会有帮助,有需要的朋友一起去看看吧

[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

相关文章

最新评论