cp命令是否有任何选项可以覆盖作为符号链接的目标文件?
问题如下:
[dthnguyen@dthnguyen test]$ ls -l
total 8
-rw-rw-r--. 1 dthnguyen dthnguyen 5 Feb 21 09:07 a.txt
lrwxrwxrwx. 1 dthnguyen dthnguyen 7 Feb 21 08:55 b.txt -> ./a.txt
-rw-rw-r--. 1 dthnguyen dthnguyen 5 Feb 21 08:55 c.txt
[dthnguyen@dthnguyen test]$ cp c.txt b.txt
Run Code Online (Sandbox Code Playgroud)
复制后,a.txt的内容为c.txt,b.txt仍然链接到a.txt.预期的结果是a.txt保存旧内容,b.txt是一个新的常规文件,其内容与c.txt相同.
Ign*_*ams 34
告诉cp先删除它.
cp --remove-destination c.txt b.txt
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11220 次 |
| 最近记录: |