如何在C中实现我自己的基本unix shell? [英] How can I implement my own basic unix shell in C?
问题描述
我是一个处理和线程管理的新手。我的shell应该理解 PATH
环境变量。它可以设置和修改。它以两种方式运行 - 批处理模式。 Shell能够执行多个工作,如ls; ps; wc file; cal。我想让我的手脏信号了。所以我应该处理^ K,^ c。
I'm a newbie to process and thread management. My Shell should understand PATH
environment variable. It can be set and modified. It runs in two ways -interactive & batch mode. Shell is capable of taking more than one job like ls;ps;wc file;cal. I want to get my hands dirty on signals too. So I should handle ^K , ^c as well.
我知道我必须使用exec,fork和pipe,但是不能开始。 >
I know I will have to use execs, forks and pipes but just can't get started.
推荐答案
所有unix shell都是开源的 - 所以一个好的开始可能是读代码。
All the unix shells are open-source - so a good place to start may be to read the code.
如果您正在寻找关于该主题的好的入门文章,请尝试写作
If you're looking for a good starter article on the subject try Writing Your Own Shell from the Linux Gazette.
另一个好的开始点是查看 mini-shell 只是因为它是最小的,让你的头圆。
Another good starting point is to take a look at the source code of mini-shell just because its one of the smallest to get your head round.
这篇关于如何在C中实现我自己的基本unix shell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!