I have written a very basic shell in C. It reads the input, then runs it using system(lineCopy); (lineCopy being a copy of the input). All commands will run fine in it, other than cd. When I try to cd to a different directory, it simply stays in the current directory. If I try to cd to a directory that doesn't exist, it says, as it should sh: 1: cd: can't cd to /some_nonexistant_directory. When I try to cd to a directory that DOES exist, however, it reads that command, but then stays in the same directory. The variable in which I store the current PWD is continuesly updating, so it cannot be that. All other commands work perfectly. But why does cd not?
Why is my CD command not working on a home-built shell?
shell;c;cd command