mv command exist with code 0, even if it falls..

Nemesis

Member
Joined
Nov 19, 2019
Messages
31
Reaction score
5
Credits
46
I'm currently writing a script to rename a file (by using the mv command)

However, when the move fails, due to file already exist, the mv command exist with code 0

If I'm pressing ctrl-c, I will get exit code 130..

Is mv supposed to behave like this?
How why, I'm confused..
Isn't there anyway to get around this issue?
Must I first do a check if the file already exist?
 


i'd take a look at the mv manpage and see if a -f or some other flag will force it to overwrite something.
Could work, but not if you want to keep the first file..
 


Top