bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61105: cp/mv: want a fatal --no-clobber


From: Mike Frysinger
Subject: bug#61105: cp/mv: want a fatal --no-clobber
Date: Fri, 27 Jan 2023 15:52:09 -0500

i've been under the mistaken assumption that the -n/--no-clobber option exits
non-zero when the target exists, but someone pointed out to me recently that
it silently ignores existing files.  can we get a setting to control this ?

basically i've been writing things like:
if ! cp -n foo bar; then
  ... error out because bar already exists, or otherwise failed ...
fi

when really i need to write:
if [ -e bar ] || ! cp foo bar; then
  ... error out ...
fi
-mike

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]