|
|
请教各位大侠, 我在一些基于gentoo CD改造而来的启动光盘里的启动脚本(内核初始化之后执行的)中看到exec命令的使用, 但是这个命令的解释来说,使用了这个命令的话, 就会把当前的shell的进程给替换掉, 而使脚本之后的命令不能执行.
而实际上该exec ... 命令后的脚本都能正常执行, 这是为什么呢? 是不是由于执行这个初始化shell脚本的进程是特殊的, 所以不会导致进程中止 而继续执行之后的语句呢?
一些相关的语句:
(1)运行了的exec...语句:
exec >${CONSOLE} <${CONSOLE} 2>&1
(2)运行完上面的脚本后, 运行一下语句:
if [ "$$" != '1' ]
then
echo '/linuxrc has to be run as the init process as the one'
echo 'with a PID of 1. Try adding init="/linuxrc" to the'
echo 'kernel command line or running "exec /linuxrc".'
exit 1
fi |
|