我正在嘗試使用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