How can I use chdir function in Linux?

后端 未结 1 828
时光说笑
时光说笑 2021-01-27 17:07

I have a question, here is my original code in the testchdir.c file:

#include 
#include 
#include 

int main(int a         


        
1条回答
  •  没有蜡笔的小新
    2021-01-27 18:04

    It's because the shell starts a new process for your program, and you only change the current directory in that new process. The shells process will be unaffected.

    Unfortunately (for you) there's no real good (or legal) way to change the working directory of the parent process (the process of the shell).

    0 讨论(0)
提交回复
热议问题