When I type
mv ../* .
mv: cannot move '../<dir name>' to a subdirectory of itself, './<dir name>'
How does the shell/mv command detect this behaviour?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know, mv uses the
rename()POSIX syscall, for which the specification says:… along with a myriad of other detailed failure modes.
The operating system presumably implements the detection at the general VFS layer by comparing the inode numbers of the intermediate directories along the hierarchy.