我如何能实现用C我自己的基本的UNIX shell? [英] How can I implement my own basic unix shell in C?

查看:174
本文介绍了我如何能实现用C我自己的基本的UNIX shell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新手,进程和线程管理。我的外壳应该明白 PATH 环境变量。它可以被设置和修改。这两种方式运行-interactive&安培;批处理模式。壳牌能够采取多个作业ls之类; PS; WC文件; 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.

我知道我将不得不使用的高管,叉和管道,但就是不能上手。

I know I will have to use execs, forks and pipes but just can't get started.

推荐答案

所有的UNIX shell是开源的 - 所以一个良好的开端可能是阅读code

All the unix shells are open-source - so a good place to start may be to read the code.

如果你正在寻找关于这个问题的尝试从Linux公报编写自己的shell 一个很好的入门文章。

If you're looking for a good starter article on the subject try Writing Your Own Shell from the Linux Gazette.

另外一个很好的出发点是要看看小壳源$ C ​​$ C ,只是因为它的最小的一个,让您的头一轮。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆