Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - background process in shell
Search - background process in shell - List
DL : 0
本实验要实现一个简单的命令解释器,也就是Linux中的shell程序。实验程序起名为ysh,要求其设计类似于目前流行的shell解释程序,如bash、csh、tcsh,但不需要具备那么复杂的功能。ysh程序应当具有如下一些重要的特征:  能够执行外部程序命令,命令可以带参数。 . 。  能够执行fg、bg、cd、history、exit等内部命令。  使用管道和输入输出重定向。  支持前后台作业,提供作业控制功能,包括打印作业的清单,改变当前运行作业的前台/后台状态,以及控制作业的挂起、中止和继续运行。 除此之外,在这个实验中还须做到:  使用make工具建立工程。  使用调试器gdb来调试程序。  提供清晰、详细的设计文档和解决方案。 -This experiment in order to achieve a simple command interpreter, that is, the shell process in Linux. Experimental procedure named ysh, required that their design is similar to the current popular interpretation of the procedures of the shell, such as bash, csh, tcsh, but it does not need a less complex function. ysh procedures should have the following important features:  external procedures to perform the command, the command can take parameters. . .  to perform fg, bg, cd, history, exit the internal order.  the use of input and output pipes and redirection.  support before and after the Taiwan operations, the provision of operating control functions, including a list of print jobs, change the current operation of the front running/background status of the pending operation and control, suspension and continue to run. In addition, this experiment must be done:  make tools to use to establish the project.  use gdb
Date : 2026-01-02 Size : 8kb User : 香烟

1、 首先利用readline()函数读到用户输入的shell命令,采用一个数组来保存shell命令,数组有固定的大小。 2、 在main()函数中根据字符串中是否存在 "&" 字符判断是否为后台进程。如果是后台命令则判断是否是多条指令,如果不是将分割后的命令传递给pipel()函数,如果是的话分割之后利用while循环将命令传递给pipel()函数。如果不是后台进程,需要用waitpid()函数等待子进程结束后父进程才继续。 -1, we use readLine () function to read user input shell command, use an array to save the shell command, arrays are fixed size. 2, in the main () function according to the string in the existence of "&" characters to determine whether the background process. If the background is to determine whether the command is a command, if not pass after segmentation command for the pipel () function, if is the words segmentation based on while cycle to pass commands to pipel () function. If not the background process, need to use waitpid () function to wait for the child process to end a process to continue.
Date : 2026-01-02 Size : 29kb User : rrr
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.