It looks like I cannot change the working directory of the parent process, but is there any way to simulate this? I am learning C by writing a command-line tool x
that allows the user to navigate the filesystem with custom commands. Would it be possible to write something like x enter [directory]
and then x look
and get something equivalent to cd [directory]
and then ls
?
My only thought is reading/writing to some .config
file before/after every command, a way of managing state across multiple x
executions.
I realize this is a problem of my own making, but I've had a lot of fun playing with C and don't want to give up on my idea for a tool that wraps the basic filesystem traversal of the Unix builtins.