所属分类:
驱动编程
开发工具:Visual C++
文件大小:1KB
下载次数:13
上传日期:2011-12-15 12:49:48
说明: 实现一个简单的shell,实现步骤:(1)在虚拟的shell界面上出现命令提示符($或#);
(2)获取用户指令:获取用户在命令提示符后面输入的命令及其参数,并注意命令输入的最大长度;
(3)解析指令:对用户输入的命令进行解析,解析出命令名和参数;
(4)寻找命令文件:每个命令的执行都必须依靠对应的可执行文件,这些文件的存放路径存放在用户的PATH环境变量里;
(5)执行命令:可通过fork( )系统调用创建一个进程来完成执行命令的任务,具体的命令执行用execv( )函数。
(
Implement a simple shell, implementation steps: (1) appears on the virtual shell interface command prompt ($ or#) (2) to obtain user instructions: Get the user at the command prompt type the command and its parameters, and Note that the maximum length of command input (3) resolve command: the command to parse user input, parse out the command name and parameters (4) to find the command file: Each command must rely on the implementation of the corresponding executable files storage paths stored in the user s PATH environment variable (5) execute the command: by fork () system call to create a process to execute the command to complete the task, the specific command with execv () function.)
文件列表:
12.txt,4148,2011-12-14