首页 > 网络科技 > CentOS下如何避免文件覆盖?

CentOS下如何避免文件覆盖?

来源:好再见网 2017-01-08 11:11:19

  [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

本文标签:

分享:

扫一扫在手机阅读、分享本文