Please !!! Use c to compile a simple shell program-general Linux technology-Linux programming and kernel information. The following is a detailed description. Compile a simple shell program with the following requirements:
1. This shell must support the following internal commands:
1. cd -- Change the current directory If no Parameter to display the current directory. If the directory does not exist, an error is returned. This command can be used to change the PWD environment variable.
2. clr -- clear screen.
3. dir -- List Directories .
4. environ -- list all environment variables.
5. echo -- Display on the screen And line feed.
6. help -- display the user manual and use the more command to filter.
7. pause -- Stop shell until press Enter.
8. quit -- exit shell.
9. shell environment variables should contain shell = /Myshell, where /Myshell is the complete path of the executable program shell.
2. Other command lines are interpreted as program calls. The shell creates and executes the program and serves as its own sub-process. The environment variables of the program must include the following entries:
Parent = /Myshell,
3. shell must be able to extract command line input from the file. For example, shell is called using the following command line:
Programname arg1 arg2 Outputfile
4. shell must support I/o redirection, stdin and stdout, or one of them. For example, Command Behavior
Programname arg1 arg2 Outputfile
Use the arg1 and arg2 execution programs programname. The input file stream is replaced with inputfile, and the output file stream is replaced with outputfile.
Stdout redirection should support the following internal commands: dir, environ, echo, and help.
Output redirection is used. If the redirection character is>, an output file is created. If yes, an output file is overwritten. If the redirection character is>, an output file is created, if yes, add it to the end of the file.
5. shell must support background program execution. If you add the character & after the command line, You need to return to the command line prompt immediately after the program is loaded.
6. the command line prompt must contain the current path.
Please kindly advise. It is best to give the complete code. If you do not have time to finish it all, please be sure to give the second. 3. 4. 5. .
My mailbox pagchen@163.com
Thank you !!! Hope for good news !!!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service