Sri*_*niV 5 unix linux shell mv
这是脚本,我已经挑出了我认为导致最近问题的代码块
mv sourcefile targetfile > /dev/null
Run Code Online (Sandbox Code Playgroud)
我知道一个事实,默认情况下mv会覆盖而不要求确认目标文件是否存在。因此,上面的脚本是正确的。
mv: try to overwrite `targetfile', overriding mode 0644 (rw-r--r--)?
Run Code Online (Sandbox Code Playgroud)
它唯一会提示/询问是否要覆盖确认的时间是带有–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.
Run Code Online (Sandbox Code Playgroud)
根据man
页面,该-f
选项具有以下目标:
-f, --force
do not prompt before overwriting
Run Code Online (Sandbox Code Playgroud)