Question

If I want to enter a directory by its inode number, why

cd $(find . -inum $inode_num) 

works, but the following command does not work:

find . -inum $inode_num -exec cd {} \;

what's the difference between these two, and why is the 2nd one wrong?

Was it helpful?

Solution

cd is not a program that can be executed, it's a built-in shell command. It has to be, since it's too hard to change current directory in parent process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top