我正在尝试使用cp
命令并强制覆盖。 bash
我试过cp -rf /foo/* /bar
,但仍然提示我确认每次覆盖。 spa
默认状况下, cp
具备别名到cp -i
。 您能够检查它,键入alias
,你能够看到一些像: code
alias cp='cp -i' 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'
要解决这个问题,只需使用/bin/cp /from /to
命令代替cp /from /to
it
你也能够使用这个命令: io
cp -ru /zzz/zzz/* /xxx/xxx
command
它会用更新的文件更新你现有的文件。 方法
在没有别名的状况下调用命令的另外一种方法是使用bash中的内置command
。 di
command cp -rf /zzz/zzz/*
文件
cp
一般是这样的别名 co
alias cp='cp -i' # i.e. ask questions of overwriting
若是您肯定要进行覆盖,请使用如下命令:
/bin/cp <arguments here> src dest
它不是cp -i
。 若是您不想被要求确认,则为cp -n
; 例如:
cp -n src dest
或者在目录/文件夹的状况下:
cp -nr src_dir dest_dir