Help with coding my own shell in C, Unix environment

In summary, the student is struggling with writing their own shell in C for a programming assignment, which also needs to support piping, redirection, and appending. They are seeking resources and tutorials to help them complete the assignment, and are encouraged to use their textbook, reach out to their professor, and collaborate with peers for support.
  • #1
frankfjf
168
0

Homework Statement



Need to write my own shell in C for a Programming assignment. It must also support piping, redirection, and appending.

Homework Equations



The professor provided a preliminary version of the program that supports piping, but not redirection of either input or output, and of course no appending. (So <. >, and >> do not work)

The Attempt at a Solution



Due to personal problems, I didn't get to start on this assignment as early as I would have liked. The professor did not go over how to implement the logic for <, >, or >> in class, and the tutorial link he provided only explains how processes work and how to play with them somewhat, but it didn't explain how to implement redirection or appending.

Would anyone happen to know of some good tutorials I could reference on this sort of thing to get this assignment done?

Thanks
 
Physics news on Phys.org
  • #2
for any help in advance

Dear student,

I understand that you are facing some challenges in writing your own shell in C for your programming assignment. It can be overwhelming to tackle a project like this, especially with the added complexity of supporting piping, redirection, and appending.

First of all, I would like to assure you that you are not alone in this. Many students struggle with similar assignments, and it is completely normal to feel overwhelmed or unsure about how to proceed. The fact that you are seeking help and resources shows that you are determined to do well in this assignment, and that is a great attitude to have.

In terms of resources, I would suggest starting with your textbook or lecture notes. They may have covered some of the concepts and techniques that you need to implement in your shell. If not, you can also try searching online for tutorials or guides on how to implement these features in a shell. Some popular resources include "The Linux Programming Interface" by Michael Kerrisk and "Advanced Programming in the UNIX Environment" by W. Richard Stevens and Stephen A. Rago.

Additionally, you can also reach out to your professor or teaching assistant for guidance and clarification. They are there to help you and can provide valuable insights and tips on how to approach the assignment.

Finally, don't forget about the power of collaboration and peer support. Consider forming a study group with your classmates and working on the assignment together. You can also use online forums or chat groups to discuss and troubleshoot any issues you may encounter.

I hope these suggestions help you in completing your assignment. Remember to take breaks and not get too overwhelmed. With determination and the right resources, I am confident that you will be able to successfully write your own shell in C. Best of luck!
 

1. What is a shell in the Unix environment?

A shell is a command-line interface that allows users to interact with the Unix operating system. It interprets user commands and executes them by communicating with the operating system's kernel.

2. Why would I want to code my own shell in C?

C is a powerful programming language that is commonly used in Unix systems. By coding your own shell in C, you have full control over its functionality and can customize it to your specific needs.

3. What are the basic steps for coding a shell in C?

The basic steps for coding a shell in C include setting up the environment, reading and parsing user input, executing commands, and handling errors. It is also important to consider security measures and handle signals from the operating system.

4. Are there any resources available to help me with coding my own shell in C for the Unix environment?

Yes, there are many resources available online that provide tutorials, guides, and sample code for coding a shell in C. You can also refer to official documentation for the Unix system you are working with.

5. What are some common features of a shell that I should include in my code?

Some common features of a shell include command history, tab completion, input/output redirection, and the ability to execute external programs. You may also want to include features such as aliasing, job control, and scripting capabilities.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
  • Programming and Computer Science
Replies
19
Views
4K
Back
Top