[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mv bug report
From: |
Bob Proulx |
Subject: |
Re: mv bug report |
Date: |
Sat, 23 May 2015 11:18:14 -0600 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Sergiy wrote:
> While renaming some files, I've discovered that my mv binary does
> not respond in any way to -i or --interactive option.
Thank you for the report. However I think this is simply a
misunderstanding of what -i does. The documentation says:
‘-i’
‘--interactive’
Prompt whether to overwrite each existing destination file,
regardless of its permissions. If the response is not affirmative,
the file is skipped. If you specify more than one of the ‘-i’,
‘-f’, ‘-n’ options, only the final one takes effect.
As can be read this only affects overwriting files. If no file is to
be overwritten then there is no prompting.
The documentation is always included with the package (I always prefer
the included documentation because then it always matches the version
in use) the documentation is also available online. The above section
is available for reading here:
http://www.gnu.org/software/coreutils/manual/html_node/mv-invocation.html#mv-invocation
> In the screenshot bellow you can see me use
Please do not send screenshot images to mailing lists. They are
relatively large compared with the information they provide. They
cannot be easily searched by users looking for the information.
Instead please simply cut and paste the plain text into the mail
message. Plain text is always best.
> mv -i or mv --interactive which still acts as regular mv, in two
> different shells, first mksh, then bash.
I will transcribe your image for the others on the mailing list.
$ echo "TEST" | tee input.txt
TEST
$ mv -i input.txt input.txt.bak
$ mv --interactive input.txt.bak input.txt
$ bash
$ mv -i input.txt input.txt.bak
$ mv --interactive input.txt.bak input.txt
And now my comments on the above.
> $ echo "TEST" | tee input.txt
> TEST
> $ mv -i input.txt input.txt.bak
> $ mv --interactive input.txt input.txt.bak
Unless input.txt.bak already exists this will not prompt. Try this
next test case instead.
$ env LC_ALL=C bash # to get standard messages not localized
$ echo foo > file1
$ echo bar > file2
$ env mv -i file2 file1
mv: overwrite 'file1'?
Here I am using "env" with "env mv" to ensure that the shell has not
replaced the command with an alias. Because software distributions
often add to the users .bashrc file aliases for mv such as "mv -i"
that get in the way. If I knew it was a posix-like shell I could have
simply quoted it with "\mv" instead. Also LC_ALL=C here is only so
that the messages output will be the standard ones also without my
locale changing quotes so that the messages search easier.
> $ bash
Stacking another shell won't have any effect. If you say why you
thought it might we on the list could talk about it. The utilities
such as mv are external to the shell. They are affected by
environment variables. Stacking a bash shell actually could change a
lot of hidden things because it loads the ~/.bashrc file which may
include many things. Here I am not expecting an environment variable
to change anything but an alias in the .bashrc file might change the
mv command, usually to "mv -i".
> $ mv -i input.txt input.txt.bak
> $ mv --interactive input.txt input.txt.bak
This is simply the same thing again.
> I found this email on the coreutils webpage, and hope I am not
> causing any inconvenience by sending a message here; I don't have
> experience with reporting bugs, but I though this would be worth
> mentioning and may be useful to some
You have found the right place to discuss all aspects of the coreutils
programs. Please feel free to send any questions or comments to this
mailing list. When replying to messages such as this one or others
please keep the mailing list address in the recipient list so that all
may participate in the discussion.
Bob