0

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?

TiisCool
  • 3
  • 1
  • 3

1 Answers1

2

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.

Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69