Did you consider that more than one terminal can be open, and at the second terminal, "b" could be renamed before replying to the mv command?

Regards

 Leslie
Leslie Satenstein
Montréal Québec, Canada



On Monday, March 25, 2019, 2:07:25 a.m. EDT, 積丹尼 Dan Jacobson <jidanni@jidanni.org> wrote:


$ mv a b
mv: overwrite 'b'? y
mv: cannot overwrite non-directory 'b' with directory 'a'

User thinks well why didn't you check before uselessly asking me?

Full story:
$ mkdir a
$ touch b
mv: overwrite 'b'? y
mv: cannot overwrite non-directory 'b' with directory 'a'
$ \mv a b
mv: cannot overwrite non-directory 'b' with directory 'a'
$ alias
alias mv='mv -i'

So even if -i is in effect, please do the check before asking users
useless questions.