[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12365: Should cp -n return 0, when DEST exists?
From: |
Jim Meyering |
Subject: |
bug#12365: Should cp -n return 0, when DEST exists? |
Date: |
Thu, 06 Sep 2012 17:24:02 +0200 |
Bernhard Voelker wrote:
> On September 6, 2012 at 4:31 PM Eric Blake <address@hidden> wrote:
>
>> $ echo one > bar
>> $ echo two > blah
>> $ cp -n blah bar
>> $ echo $?
>> 0
>> $ cat bar
>> one
>>
>> that FreeBSD also returns 0 in this case, and I don't want to break
>> interoperability. Therefore, I'm going to close this as a WONTFIX,
>> unless you also get buy-in from the BSD folks.
>
> Actually -n is implemented as if the user had answered 'n'
> when he used the -i option - sure enough without prompting
> the user.
>
> $ echo n | cp -vi blah bar
> cp: overwrite `bar'?
> $ echo $?
> 0
>
> BTW: it's similar with the mv command.
>
>
> The texi page is a bit sparse about the exit value:
>
> @exitstatus
>
> Maybe it's worth adding a line about the exist status
> when using -n or -i (together with answering 'n')?
Yes, please. That would be an improvement.