在读APUE,突然想到如果让我们自己实现一个Shell,该怎么实现呢?有哪些功能需要做?又该如何做?
http://www.gnu.org/software/libc/manual/html_node/Implementing-a-Shell.html
http://stephen-brennan.com/2015/01/16/write-a-shell-in-c/
http://stackoverflow.com/questions/1500004/how-can-i-implement-my-own-basic-unix-shell-in-c
希望能帮到你
(我并没细读过…………)
https://github.com/David-Guo/myshell
这是我上 OS 课时,写的一个 mini shell
,代码量300行左右
支持以下功能:
解释执行命令
内建命令
cd
exit
pipe 管道
fg 前台执行命令
bg 后台执行命令
彩色提示符
Ctrl -Z Ctrl -C 信号处理
希望能给你提供一个思路和 demo 。