That may be the case under Leopard, but for many users of Linux, ‘cd’
is a command that is built into the ‘bash’ shell.
As a result, a call to the command ‘cd’ using exec wont work. This is
probably one of the reasons that languages such as Ruby include
functions for precisely this operation.
The message
into.rb:1:in `exec’: No such file or directory - cd /tmp
(Errno::ENOENT)
is complaining that there is ‘No such file or directory’ as ‘cd’…
not ‘/tmp’. You can confirm this:
$ cat into.rb
exec “cd”
$ ruby into.rb
into.rb:1:in `exec’: No such file or directory - cd (Errno::ENOENT)
from into.rb:1