1

可能重复:
为什么“cd”在 bash shell 脚本中不起作用?
使用 C 程序回到 Linux 中的上一个目录

chdir函数会更改目录,但不会更改原始目录。

例如:

$ pwd
  ~/home/loganaayahee
 $ cc chdir
 $ ./a.out ~/Desktop
 The directory change sucess and the current dir is ~/Desktop
 $ pwd
 ~/home/loganaayahee

shell 不会更改目录。是什么原因?所以我确实改变了原来的目录我做什么?chdir() 函数的用途是什么?

4

0 回答 0