How does `cd` work?
blog.safia.rocks
How does `cd` work?
1–10 of 93 posts
Re: How does `cd` work?
#2Re: How does `cd` work?
#3Re: How does `cd` work?
#4Re: How does `cd` work?
#5cd.. (no space between "cd" and "..") works on Windows
Re: How does `cd` work?
#6You see, at that point Unix had no fork system call. There were multiple processes, but they were created statically at startup rather than on-demand. Running a command in the shell would cause the command to replace the shell in the address space of the process, and the process quitting would put the shell back in there.
This worked perfectly with cd being a normal command. Then they implemented fork() and were for a while very confused trying to debug how in the world fork() could have broken the chdir() system call :)
Re: How does `cd` work?
#7The funny thing here: why does cperciva, of tarsnap fame, show up in the source code of the CD script? I saw it on the article, checked it on my Mac, and it does indeed show up. Intriguing.
https://github.com/freebsd/freebsd/commit/0bc1bed704cc7b7292...
Re: How does `cd` work?
#8Unfortunately, I learned that there's is no way to invoke cd programmatically from a program, but I didn't get an explanation I could understand why this is not possible.
Can someone explain why you can't invoke cd from a program?
Re: How does `cd` work?
#9I tried to create a command line tool that mimics some behavior of a bookmark manager in the terminal. https://github.com/serv/lbm Unfortunately, I learned that there's is no way to invoke cd programmatically from a program, but I didn't get an explanation I could understand why this is not possible. Can someone explain why you can't invoke cd from a program?
Re: How does `cd` work?
#10The funny thing here: why does cperciva, of tarsnap fame, show up in the source code of the CD script? I saw it on the article, checked it on my Mac, and it does indeed show up. Intriguing.