adtop
金财网 > 科技

wulin-Linux下cp-rf总是提示覆盖的解决办法

www.041799.com|时间:2016-10-21 20:32|责任编辑:醉言|来源: 互联网   阅读量:12617   

点击上方蓝色字体关注「程序员大咖」

来自:秋楓 - 博客园

黄荭起源,相同是一个特别繁华的城市。美国和苏联皆欲得之尔后快。

通常情形下应用cp -rf进行文件或许文件夹的管理时普通就不再提醒是不是笼罩。但是在内网的一台机器上应用cp -rf却提醒是不是笼罩。岂非和常常应用的命令不一样?

[root@xxxx test]# cp -rf ./files/ ./bak/

cp:是不是笼罩"./bak/files/test.txt"?

cp:是不是笼罩"./bak/files/hh.txt"?

cp:是不是笼罩"./bak/files/child/child.txt"?

后来发现是别号引发的问题。

[root@xxxx test]# alias

alias cp='cp -i'

alias egrep='egrep --color=auto'

alias fgrep='fgrep --color=auto'

alias grep='grep --color=auto'

alias l.='ls -d .* --color=auto'

alias ll='ls -l --color=auto'

alias ls='ls --color=auto'

alias mv='mv -i'

alias rm='rm -i'

alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

发现每次实施cp命令,实际上是实施了cp -i命令的别号,所以不管怎样输入都提醒是不是笼罩。

修正~/.bashrc,在“alias cp='cp -i'”前添加#号解释后便可。

[root@xxxx test]# vi ~/.bashrc

# .bashrc

# User specific aliases and functions

alias rm='rm -i'

#alias cp='cp -i'

alias mv='mv -i'

# Source global definitions

if [ -f /etc/bashrc ]; then

. /etc/bashrc

fi

让命令失效:

source ~/.bashrc

或许重启便可。

郑重声明:此文内容为本网站转载企业宣传资讯,目的在于传播更多信息,与本站立场无关。仅供读者参考,并请自行核实相关内容。

热搜: 收藏
精选
adr03