why calling cd shell command through system() or execvp() from a child process won't work?

I understand that i am supposed to use chdir() but I just need an explanation as to why calling cd shell command through system or execvp() from a child process would not work? Thanks!!


Because chdir only modifies the environment of the current process. It can't touch the environment of the parent.

See also the link posted by tripleee.


  • C Shell hanging when dealing with piping
  • shell script run when I am root but I get a permission denied when it is invoked from a Makefile (st
  • Delete files that match regex
  • Perl chdir doesn't work
  • python opencv SIFT doesn't work for 8 bit images (JPEG)
  • How to combine multiple csv into one file in serial manner using python?
  • redirecting output of execvp into a file in C
  • Why does checkout sometimes stage a file?
  • Ignore some files from SVN commit
  • SEO friendly 301 redirect .htm to .aspx
  • Modifying files nested in tar archive
  • VB.Net Double comparison after some additions
  • Zeromq with python hangs if connecting to invalid socket
  • cd command not working with execvp
  • How do I check if System::Collections:ArrayList is empty / nullptr / null?
  • init_seg and warning C4073 from library code?
  • iOS Localization Doesn't Work with More Than 63 Files
  • user data scripts fails without giving reason
  • what does prefix @- mean in makefile?
  • Installing Perl6 and Panda on Ubuntu 15.10. Problems with bootstrap.pl
  • extjs4 catching the scroll event on panel
  • How can I get the full list of running processes on a Mac from a python app
  • there is no graph with tensorboard
  • npm 5.4.1 install/uninstall all failing
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • Word Open XML Mail Merge
  • Spark fat jar to run multiple versions on YARN
  • Using jQuery closest() method with class selector
  • QLineEdit password safety
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Array.prototype.includes - not transformed with babel
  • How do I fake an specific browser client when using Java's Net library?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Why winpcap requires both .lib and .dll to run?
  • Apache 2.4 - remove | delete | uninstall
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • How does Linux kernel interrupt the application?