Stephane Chazelas <stephane.chaze...@gmail.com> wrote, on 07 Nov 2016: > > BTW, there's an issue in the spec for "mv": > > > EXIT STATUS > > > > The following exit values shall be returned: > > > > 0 > > All input files were moved successfully. > > >0 > > An error occurred. > > In > > mv -i a b > > if the user says "no", "a" will not be moved successfully, and > there will not have been any error.
Good catch. > Should probably be something like: > > 0 > All input files (approved by the user with -i) were > moved successfully. We should change it to match rm, which says: Each directory entry was successfully removed, unless its removal was canceled by a non-affirmative response to a prompt for confirmation. > Also, should failure to write the prompt or read the answer be > considered an error? I would say yes. > Using: > > mv -i a b 2>&- <&- > > or > > mv -i a b < /dev/null 2>&- However, that's not a valid test because of the following text on the execl() page: If file descriptor 0, 1, or 2 would otherwise be closed after a successful call to one of the exec family of functions, implementations may open an unspecified file for the file descriptor in the new process image. If a standard utility or a conforming application is executed with file descriptor 0 not open for reading or with file descriptor 1 or 2 not open for writing, the environment in which the utility or application is executed shall be deemed non-conforming, and consequently the utility or application might not behave as described in this standard. -- Geoff Clare <g.cl...@opengroup.org> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England