Red Hat Bugzilla – Bug 213185
mv --reply=no not working
Last modified: 2007-11-16 20:14:54 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:22.214.171.124) Gecko/20060909 Firefox/126.96.36.199
Description of problem:
Trying to use the mv command to automatically not overwrite any destination file that already exists using the --reply=no option. This option seems to behave the same as --reply=yes (just overwrites any existing destination file).
Don't know if this --reply is deprecated or not for mv. However, --reply=yes and --reply=query seem to work, as well as their other equivalent options.
There doesn't seem to be an equivalent option to --reply=no for mv though?
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. echo file1 > file1
2. echo file2 > file2
3. /bin/mv --reply=no file1 file2
-> the destination file was overwitten / the move took place.
[root@rouge test]# cat file1
cat: file1: No such file or directory
[root@rouge test]# cat file2
-> mv should have realized that the destination file exists and that we want to answer "no" to any prompt about overwriting.
This is intentional behaviour. '--reply=no' only applies to prompts that would
have been displayed in the absence of a --reply option. Since 'mv a b' here
would have succeeded without any prompt, there is no prompt to reply 'no' to.
An example of --reply=no is here:
$ echo a>a
$ echo b>b
$ chmod a-w b
$ mv --reply=no a b
$ cat b
$ mv a b
mv: overwrite `b', overriding mode 0444?