Prompt confirmation y/n to move a file...

Hello

I believe that there should be no prompt confirmation y/n to move a file using mv, for instance, or to copy, to delete... using regular mv, cp and rm.

Reason because it can be an issue and best example
bsd is not like windows.

best regards
sp.
 
There is none. You have to explicitly request this behavior with -i. Maybe you have an alias configured in your shell.
 
there should be no -i or other.

For instance,
mv freedom without popups for a terminal. one can leave this for X.
 
By default it doesn't ask for confirmation. Are you suggesting the -i option needs to be removed? Why?
 
People seem to be oblivious to the fact that tools like mv, cp, et al. are used in production environments by scripts, automation, build systems, etc.
These flags are there so admins and devs can override default behavior for debugging purposes to solve real problems.
 
As has been written above, that isn't the default behavior of mv, somehow it got configured that way on your machine.
Secondly, if you have a disagreement with a design decision, the best place to try to get it changed would be by filing a pr, rather than mentioning it here. Though, IMHO, asking here does X or Y merit filing a pr is fine. (And as you found by asking here, it isn't a default design decision).
 
By default it doesn't ask for confirmation. Are you suggesting the -i option needs to be removed? Why?

we talk unix or not.
if it is unix there shall be no confirmation.

mv shall have no confirmation. it is a danger for integrity of the user data and usage.
 
we talk unix or not.
if it is unix there shall be no confirmation.
The confirmation question is optional.

 
Which is the default behavior. Confirmation is an optional feature that must be explicitly requested on invocation. Is there anything you don't understand about that? So, what exactly is your problem?
 
Why would we want to make a change to a tool that acts as a safeguard if the admin so chooses? As xtremae stated, in a production environment, there should be some safeguard in place to prevent damaging a system accidentally. If you don't what a prompt, don't enable it.
 
I am sorry that you don't get it. It is simple and easy to understand. Let's try to discuss together about it, it if you would like...

rm with and without -rf has a clear distinction for the usage, but it will never ask user for a confirmation. Off course, not.
This is not without an meaningful intention behind.

A SH script need to be ruled by rules, which are coherent with the all system. CP, MV or RM do no need confirmation for default copy and delete operations, right. The shell is the backend of X, and it shall be readily operational for further advanced scripting using shell or other.

In an Unix like system, whatever it is, cp, mv and rm are the most important binaries, actually for an Unix operating system, especially BSDs which are believed to be more reliable. If you need to consider annoyance, giving high risks for file operations on large harddisks, then it will endanger the basic admin operations.

A binary such as cp, rm and mv shall never need a single confirmation by default, because it would highly endanger the operating system and user data. It should be fairly important to remove confirmations from those. It is important to do backup, copy, delete, move without any doubts that it will be unrealiable.

An override issue can be forced, but it could be left free of confirmation from the user.

Crivens
Likely you won't accept that earth is not flat... but I tried to explain you in further details. :(

(Just simple understanding of Unix basics is necessary to understand the above.)
 
You're confused. cp, rm and mv all have the same consistent behavior, not only on FreeBSD, but e.g. as well on GNU and probably any other UNIX-like system: By default, no confirmation is asked. -i requests confirmation when anything would be overwritten or deleted. -f means "do anything possible" and also overrides -i.
 
You're confused. cp, rm and mv all have the same consistent behavior, not only on FreeBSD, but e.g. as well on GNU and probably any other UNIX-like system: By default, no confirmation is asked. -i requests confirmation when anything would be overwritten or deleted. -f means "do anything possible" and also overrides -i.

override is an issue.
 
It is. And this is getting ridiculous. If you think it isn't, describe exactly what you do (exact command typed) and how the outcome is not what I described above.

Just to make this as clear as possible:
  • mv will overwrite target without asking
  • mv -i will ask before overwriting
  • mv -i -f will overwrite without asking
This is *the same* behavior like rm and cp.
 
It is. And this is getting ridiculous. If you think it isn't, describe exactly what you do (exact command typed) and how the outcome is not what I described above.

Just to make this as clear as possible:
  • mv will overwrite target without asking
  • mv -i will ask before overwriting
  • mv -i -f will overwrite without asking
This is *the same* behavior like rm and cp.

Tell me a single good reason why it should ask ....
 
Doing stuff interactively as root on a production system? That's what -i stands for: interactive. It's recommended to configure aliases for such interactive use. If you don't like the feature, just don't use it.
 
Doing stuff interactively as root on a production system? That's what -i stands for: interactive. It's recommended to configure aliases for such interactive use. If you don't like the feature, just don't use it.

Did you understand my above post, describing in details this?
 
Not that I would fully get the idea of the thread (propably it's not meant to ;) ), but the -i has good use cases, e.g. when some files with unprintable characters have appeared and we're not certain if our glob does catch them (or might catch something else).
 
% touch non sense
% ls
non sense
% mv non sense
% ls
sense

No question asked.
 
Spartrekus, sorry, but if you would have described your situation better we could have prevented an X-Y problem.
What you are experiencing happens when you try to write to a file when you have not writing permissions (even if you are the owner). While this is the same behaviour you get using the -i flag, it is not optional, and is the behaviour defined by POSIX in such cases: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mv.html.
Moreover, specifing the -f flag you can override this behaviour (again, this is defined by POSIX too).
 
Back
Top