How to deal with duplicate file names when moving files in terminal?
If you are already a homebrew user, you could install GNU coreutils and get quick access to GNU mv. This is installed as gmv so that it doesn't break any scripts that rely on BSD mv's syntax.

If you don't use homebrew and do not want to install it, you'll need to do tests with [ -f ${filename} ] etc. (which I expect is what you wanted).

Once you have homebrew installed, run,

brew install fileutils


Then you can gmv --backup=t as you wished to.