为什么这个`cp`命令试图删除文件?


8

我在Dell 50-50笔记本电脑上使用Ubuntu 12.04.2 LTS。一切顺利,直到:

[1635][lam@ubuntu:~/bin]$ ll
total 48
-rwxr-xr-x 1 lam lam  232 Jan 27 20:37 demo.sh
-rwxr-xr-x 1 lam lam   34 Aug 26 22:02 encore.sh
-rwxr-xr-x 1 lam lam   94 Nov 13 16:54 esame.sh
-rwxr-xr-x 1 lam lam  156 Jan 20 14:21 ginfo.sh
-rwxr-xr-x 1 lam lam   61 Oct 31 15:56 hello_world.sh
-rwxr-xr-x 1 lam lam 2323 Jan 20 13:36 infoscript
-rwxrwxr-x 1 lam lam  257 Dec  4 17:22 local-variable
-rwxr-xr-x 1 lam lam   16 Jan 28 15:2[1638]
[lam@ubuntu:~/bin]$ cp sayH.sh temp/sayH2.sh~
rm: cannot remove `sayH.sh': No such file or directory
rm: cannot remove `temp/sayH2.sh~': No such file or directory

我正在尝试复制文件,但是Ubuntu显然试图删除它。有人可以解释吗?


1
欢迎林老师问Ubuntu!我已经对您的问题进行了编辑,以使其更具可读性,并且标题更容易引起他人的注意。
2013年

4
aliasses使用命令检查您的alias
Rinzwind

1
检查以下内容:1)您是否为cpin ~/.bash_aliases或in 设置了别名~/.bashrc?2)您temp当前的目录中没有文件夹,所以您的意思是/ temp?3)~到达目的地的目的是什么?
Jobin

2
使用--remove-destination?...参见man cp。我建议type cp(假设使用默认的Bash)而不是alias,因为它也可以是一个函数。
0xC0000022L13年

Answers:


1

@rafalcieslak谢谢您的帮助。我cp=rm -i仅在bashrc中搜索了错误的alias(),但此目录不存在。按照您的建议,我alias在CLI上尝试过,那是不合适的。不混叠就做到了。


谁告诉你的?> :)
Rinzwind
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.