4 ms·
And for something completely different - but in the same vein - a stand-alone 'cd' binary - https://github.com/robertswiecki/extcd https://github.com/robertswie
by jagrsw 7y ago
And for something completely different - but in the same vein - a stand-alone 'cd' binary - https://github.com/robertswiecki/extcd https://github.com/robertswiecki/extcd - enjoy!
- 0xcde4c3db 7y agoFor those who aren't familiar with the significance of this, "cd" is a shell builtin because the working directory is per-process state. So while it's perfectly valid to write a program that does a chdir(2) and then exits, it's only changing its own working directory, which is pretty useless.
- Hello71 7y agoisn't this more or less the same as gdb -batch -n -ex 'call chdir("whatever")' -p $$
- vidarh 7y agoThat does seem to be conceptually pretty much what it's doing. Except your version works on more architectures. It's a simple example of ptrace() though.