Replaced pushd and popd with equivalent shell code.