'The best location to implement cd in shell?

I was wondering where is the best location to implement cd? I know that it is definitely not correct if it is implemented in the child process.

    WHILE {

    PROMPT

    A

    fork_return = fork();

    B

    if child { 
        C 
    }

    else if parent { 
        D 
    }
}

I guess its around B or D am I correct?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source