|

楼主 |
发表于 2003-11-18 16:49:28
|
显示全部楼层
bouzouki,
问题问到点子上了,这也正是这个题的原意: 什么是built-in fonction? 什么是
system call?
简单的说shell 本身就是一个程序/进程,它还是一个用户跟系统之间的一个界面,
用户通过这个界面输入指令,每一个指令都是由shell 做一个fork,产生新的子进
程,在新的子进程里 执行一下execl, execlp, execle, execv, execvp,所有用execl的都是system call。还有是shell里自己的命令,这些命令不需要用execl,这就是我们所说的shell built-in fonction。 为什么cd 必是 built-in fonction呢?请看man cd (我在最后列出来了)
system call
BSD:
man -s 2 intro
linux:
man -S 2 intro
man fork
man cd
DESCRIPTION
directory is an absolute or relative pathname which becomes the new work-ing directory. The interpretation of a relative pathname by cd depends on the CDPATH environment variable (see below).
Note that cd is implemented as a built-in shell command and not as a stand-alone program. Because each process has its own working directory,
a separate cd utility would have no effect (it would change the directory and exit, leaving the working directory in the parent unchanged). Different shells may implement cd with features different from those described here. Please consult the manual for your specific shell. |
|