以下是脚本,我已经找出了我认为引起最近问题的代码块:
mv sourcefile targetfile > /dev/null
我知道mv命令默认会在目标文件存在时覆盖它而不需要确认。因此,上面的脚本是正确的。
mv: try to overwrite `targetfile', overriding mode 0644 (rw-r--r--)?
只有使用-i选项时,它才会提示/要求确认覆盖,但在本例中未使用该选项。它不是总会发生。偶尔会弹出
那么,为什么会这样?
这是我的mv版本
mv (GNU coreutils) 8.12
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Parker, David MacKenzie, and Jim Meyering.