Where can I find the source code for Unix environment's cd
command?
I want to know how the command is implemented.
Where can I find the source code for Unix environment's cd
command?
I want to know how the command is implemented.
Here is a complete explanation how cd
works: http://web.archive.org/web/20090515201659/http://www.cs.ucr.edu/~brett/cs153_w02/syscall.html
The cd
Unix command just calls chdir
and examines the error codes.
To see the source for the bash cd command, for example:
cd is usually built-in in the shell, you should just look at the code of any shell, e.g. bash, or ash.
The cd command should be ultimately based on the chdir() function, but if you're interested in all the command line expansions, then the source is the shell.
using chdir function:
http://www.opengroup.org/onlinepubs/009695399/functions/chdir.html
© 2022 - 2024 — McMap. All rights reserved.