I have a for loop on which I have directories that the mv
command will apply the same name to its directories, other directories have different names, for example:
for i in {1..3};do
mv hg/ hg
done
Sometimes hg/
directory will differ to something else (for example dir/
as the loop proceeds) and the loop works when the names are different, but when the names are the same I get the error:
mv: cannot move ‘hg/’ to a subdirectory of itself, ‘hg/hg’
I would like ignore this behavior and make mv
just "pretend" the directories have the same name and proceed with the loop. Please note that hg
and dir
are just examples, the real directories have different names for every iteration of the loop.