I have two files new.txt
and old.txt
. In the end of my script I want to rename these files, old.txt -> old_1.txt
and new.txt -> old.txt
. These are two lines of my script:
mv old.txt old_1.txt
mv new.txt old.txt
My question is, if it is safe to use these two mv commands and if there is not possible, that second mv command will be executed (in some specific condition) earlier than first?
The script is executed once a day, and I noticed that old_1.txt
has date of modification from previous day (it wasn't replaced). However if I have run this script manually, the old_1.txt
has been modified already. Could someone explain me, where could be a problem?