Within a bash script, I would like to chroot to a directory and cd to another subdirectory immediately there after. I would like to do this via exec chroot [dir] cd [subdir], but I get a file not found error. This is because the cd command in not in the new directory tree. The cd command is normally provided by a shell, but I need to avoid starting a child process with eval.
Is there a way to change directory without requiring a shell in linux? I looked for packages containing cd in linux, but coreutils does not contain it. Thank you.
Install the
schrootprogram/package. That seems to have an option to change diretory: