]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: fix description of mv -n
authorPádraig Brady <P@draigBrady.com>
Wed, 8 Jul 2026 17:55:34 +0000 (18:55 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 8 Jul 2026 18:03:27 +0000 (19:03 +0100)
The description of mv --no-clobber got out of sync
between commit v9.1-133-g7a69df889 and v9.4-134-g9907b6f5d

* doc/coreutils.texi (mv invocation): Copy most of the -n
description from the cp --no-clobber description.
* src/mv.c (usage): Likewise.  Note this explicitly deprectates
the mv -n option as like cp the exit code varies across platforms.
Solaris 11 was seen to silently fail, while Linux/FreeBSD succeed.
Fixes https://bugs.gnu.org/81377

doc/coreutils.texi
src/mv.c

index 29baf571016af9da28aba163ba630977f3264497..d3e3723c1c0ca9d7db1d82f3909a368e4616685c 100644 (file)
@@ -8875,15 +8875,24 @@ to cause @command{cp} write to arbitrary target directories.
 @optItemx{cp,--link,}
 Make hard links instead of copies of non-directories.
 
-@optItem{cp,-n,}
-@optItemx{cp,--no-clobber,}
+@macro noClobberOption{cmd}
+@optItem{\cmd\,-n,}
+@optItemx{\cmd\,--no-clobber,}
+@cindex prompts, omitting
 Do not overwrite an existing file; silently skip instead.
+@ifset MV_COMMAND
+@mvOptsIfn
+@end ifset
+@ifclear MV_COMMAND
 This option overrides a previous @option{-i} option.
+@end ifclear
 This option is mutually exclusive with @option{-b} or @option{--backup} option.
 This option is deprecated due to having a different exit status from
 other platforms.  See also the @option{--update} option which will
 give more control over how to deal with existing files in the destination,
 and over the exit status in particular.
+@end macro
+@noClobberOption{cp}
 
 @optItem{cp,-p,}
 @optItemx{cp,--preserve,[=@var{attribute_list}]}
@@ -10015,14 +10024,9 @@ Prompt whether to overwrite each existing destination file, regardless
 of its permissions, and fail if the response is not affirmative.
 @mvOptsIfn
 
-@optItem{mv,-n,}
-@optItemx{mv,--no-clobber,}
-@cindex prompts, omitting
-Do not overwrite an existing file; silently fail instead.
-@mvOptsIfn
-This option is mutually exclusive with @option{-b} or @option{--backup} option.
-See also the @option{--update=none} option which will
-skip existing files but not fail.
+@set MV_COMMAND
+@noClobberOption{mv}
+@clear MV_COMMAND
 
 @optItem{mv,--no-copy,}
 @cindex renaming files without copying them
index cd6aab473a7ab1b651c949f3940d5322bb8c5084..3ba6f701e471feb3b57e00ea8fc129630e247a31 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -288,7 +288,7 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\
 "));
       oputs (_("\
   -n, --no-clobber\n\
-         do not overwrite an existing file\n\
+         (deprecated) silently skip existing files.  See also --update\n\
 "));
       fputs (_("\
 If you specify more than one of -i, -f, -n, only the final one takes effect.\n\