码迷,mamicode.com
首页 > 系统相关 > 详细

linux下避免文件覆盖的命令

时间:2015-08-03 22:59:55      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:linux

[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下避免文件覆盖的命令

标签:linux

原文地址:http://10596480.blog.51cto.com/10586480/1681369

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!