免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 14810 | 回复: 39
打印 上一主题 下一主题

请问如何CP的时候不覆盖文件也不出现提示信息 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-01-07 17:57 |只看该作者 |倒序浏览
让它默认不覆盖文件

论坛徽章:
0
2 [报告]
发表于 2009-01-07 18:00 |只看该作者
原帖由 @sky 于 2009-1-7 17:57 发表
让它默认不覆盖文件

自己写一个, 简单吧

论坛徽章:
0
3 [报告]
发表于 2009-01-07 19:30 |只看该作者

论坛徽章:
0
4 [报告]
发表于 2009-01-07 19:32 |只看该作者
原帖由 @sky 于 2009-1-7 17:57 发表
让它默认不覆盖文件


默认不覆盖文件但又不提示,好像有点矛盾。

论坛徽章:
0
5 [报告]
发表于 2009-01-07 20:46 |只看该作者
  1. cp -i --reply=no
复制代码

论坛徽章:
0
6 [报告]
发表于 2009-01-07 20:47 |只看该作者
[test@erpdataserver ~]$ ll ttt/*
-rw-rw-r--  1 test test  0 Jan  7 20:41 ttt/1
-rw-rw-r--  1 test test  0 Jan  7 20:43 ttt/2
-rw-rw-r--  1 test test 47 Jan  4 08:11 ttt/file1
-rw-rw-r--  1 test test 46 Jan  4 08:11 ttt/file2
-rw-rw-r--  1 test test 47 Jan  4 08:11 ttt/file3
[test@erpdataserver ~]$ ll ttt2/*
-rw-rw-r--  1 test test  0 Jan  7 20:42 ttt2/1
-rw-rw-r--  1 test test 47 Jan  7 20:39 ttt2/file1
-rw-rw-r--  1 test test 46 Jan  7 20:39 ttt2/file2
-rw-rw-r--  1 test test 47 Jan  7 20:39 ttt2/file3
[test@erpdataserver ~]$ cp -i ttt/* ttt2 --reply=no
[test@erpdataserver ~]$ ll ttt2/*
-rw-rw-r--  1 test test  0 Jan  7 20:42 ttt2/1
-rw-rw-r--  1 test test  0 Jan  7 20:43 ttt2/2
-rw-rw-r--  1 test test 47 Jan  7 20:39 ttt2/file1
-rw-rw-r--  1 test test 46 Jan  7 20:39 ttt2/file2
-rw-rw-r--  1 test test 47 Jan  7 20:39 ttt2/file3

论坛徽章:
3
戌狗
日期:2014-09-10 17:07:162015年辞旧岁徽章
日期:2015-03-03 16:54:15wusuopu
日期:2016-06-17 17:43:45
7 [报告]
发表于 2009-01-07 20:50 |只看该作者
原帖由 我是DBA 于 2009-1-7 20:46 发表
cp -i --reply=no

faint, 我这个版本没--reply了。被废弃了

论坛徽章:
0
8 [报告]
发表于 2009-01-07 20:52 |只看该作者

回复 #7 ynchnluiti 的帖子

真的啊?什么版本,废了它吧

论坛徽章:
3
戌狗
日期:2014-09-10 17:07:162015年辞旧岁徽章
日期:2015-03-03 16:54:15wusuopu
日期:2016-06-17 17:43:45
9 [报告]
发表于 2009-01-07 20:58 |只看该作者
原帖由 我是DBA 于 2009-1-7 20:52 发表
真的啊?什么版本,废了它吧
$ cp --version
cp (GNU coreutils) 6.10
Copyright (C) 2008 Free Software Foundation, Inc.

$ cp -i --reply=no dd a
cp: the --reply option is deprecated; use -i or -f instead

不过是不是可以-i,加expect

没试过,有时间再研究

论坛徽章:
0
10 [报告]
发表于 2009-01-07 21:00 |只看该作者

回复 #9 ynchnluiti 的帖子

你版本太高了
[test@erpdataserver ~]$ cp --version
cp (coreutils) 5.2.1
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP